Skip to content

Counterparties Synchronous Endpoints

This Counterparties endpoint provides methods to interact with the counterparties of the authenticated user.

Example usage of the Counterparties endpoint object:

from pyrevolut.client import Client

CREDS_JSON_LOC = "path/to/creds.json"

client = Client(
    creds_loc=CREDS_JSON_LOC,
    sandbox=True,
)

with client:
    counterparties = client.Counterparties.get_all_counterparties()
    print(counterparties)

EndpointCounterpartiesSync

Bases: BaseEndpointSync

The Counterparties API

Manage counterparties that you intend to transact with.

Request and response examples can vary based on the account provider's location and type of the counterparty.

In the Sandbox environment, you cannot add real people and businesses as Revolut counterparties. Therefore, to help you simulate Create a counterparty requests, we have created some test accounts for counterparties of profile type personal.

To add a counterparty via Revtag, use one of these pairs for the name and revtag fields respectively:

Test User 1 & john1pvki Test User 2 & john2pvki ... Test User 9 & john9pvki

Source code in pyrevolut/api/counterparties/endpoint/synchronous.py
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
class EndpointCounterpartiesSync(BaseEndpointSync):
    """The Counterparties API

    Manage counterparties that you intend to transact with.

    Request and response examples can vary based on the account provider's
    location and type of the counterparty.

    In the Sandbox environment, you cannot add real people and businesses as Revolut counterparties.
    Therefore, to help you simulate Create a counterparty requests, we have created some
    test accounts for counterparties of profile type personal.

    To add a counterparty via Revtag, use one of these pairs for the name and revtag fields respectively:

    Test User 1 & john1pvki
    Test User 2 & john2pvki
    ...
    Test User 9 & john9pvki
    """

    def get_all_counterparties(
        self,
        name: str | None = None,
        account_no: str | None = None,
        sort_code: str | None = None,
        iban: str | None = None,
        bic: str | None = None,
        created_before: datetime | DateTime | str | int | float | None = None,
        limit: int | None = None,
        **kwargs,
    ) -> list[dict] | list[RetrieveListOfCounterparties.Response]:
        """
        Get all the counterparties that you have created, or use the query parameters to filter the results.

        The counterparties are sorted by the created_at date in reverse chronological order.

        The returned counterparties are paginated. The maximum number of counterparties returned per page
        is specified by the limit parameter. To get to the next page, make a new request and use the
        created_at date of the last counterparty returned in the previous response.

        Parameters
        ----------
        name : str | None
            The name of the counterparty to retrieve. It does not need to be an exact match,
            partial match is also supported.
        account_no : str | None
            The exact account number of the counterparty to retrieve.
        sort_code : str | None
            The exact sort code of the counterparty to retrieve.
            Only allowed in combination with the account_no parameter.
        iban : str | None
            The exact IBAN of the counterparty to retrieve.
        bic : str | None
            The exact BIC of the counterparty to retrieve. Only allowed in combination with the iban parameter.
        created_before : datetime | DateTime | str | int | float | None
            Retrieves counterparties with created_at < created_before.
            The default value is the current date and time at which you are calling the endpoint.
            Provided in ISO 8601 format.
        limit : int | None
            The maximum number of counterparties returned per page.
            To get to the next page, make a new request and use the
            created_at date of the last card returned in the previous
            response as the value for created_before.

        Returns
        -------
        list[dict] | list[RetrieveListOfCounterparties.Response]
            The list of all counterparties that you have created.
        """
        endpoint = RetrieveListOfCounterparties
        path = endpoint.ROUTE
        params = endpoint.Params(
            name=name,
            account_no=account_no,
            sort_code=sort_code,
            iban=iban,
            bic=bic,
            created_before=created_before,
            limit=limit,
        )

        return self.client.get(
            path=path,
            response_model=endpoint.Response,
            params=params,
            **kwargs,
        )

    def get_counterparty(
        self,
        counterparty_id: UUID,
        **kwargs,
    ) -> dict | RetrieveCounterparty.Response:
        """Get the information about a specific counterparty by ID.

        Parameters
        ----------
        counterparty_id : UUID
            The ID of the counterparty to retrieve.

        Returns
        -------
        dict | RetrieveCounterparty.Response
            The information about the counterparty.
        """
        endpoint = RetrieveCounterparty
        path = endpoint.ROUTE.format(counterparty_id=counterparty_id)
        params = endpoint.Params()

        return self.client.get(
            path=path,
            response_model=endpoint.Response,
            params=params,
            **kwargs,
        )

    def create_counterparty(
        self,
        company_name: str | None = None,
        profile_type: EnumProfileType | None = None,
        name: str | None = None,
        individual_first_name: str | None = None,
        individual_last_name: str | None = None,
        bank_country: str | None = None,
        currency: str | None = None,
        revtag: str | None = None,
        account_no: str | None = None,
        iban: str | None = None,
        sort_code: str | None = None,
        routing_number: str | None = None,
        bic: str | None = None,
        clabe: str | None = None,
        isfc: str | None = None,
        bsb_code: str | None = None,
        address_street_line1: str | None = None,
        address_street_line2: str | None = None,
        address_region: str | None = None,
        address_city: str | None = None,
        address_country: str | None = None,
        address_postcode: str | None = None,
        **kwargs,
    ) -> dict | CreateCounterparty.Response:
        """
        Create a new counterparty to transact with.

        In the Sandbox environment, you cannot add real people and businesses as Revolut counterparties.
        To help you simulate Create a counterparty requests for counterparties of profile type personal,
        we created some test accounts. Look inside for test Revtags.

        To add a counterparty via Revtag, use one of these pairs for the name and revtag fields respectively:

            Test User 1 & john1pvki
            Test User 2 & john2pvki
            ...
            Test User 9 & john9pvki

        Parameters
        ----------
        company_name : str | None
            The name of the company counterparty.
            Use when individual_name or name isn't specified and profile_type is business.
        profile_type : EnumProfileType | None
            The type of the Revolut profile. Used when adding an existing Revolut user via Revtag.
        name : str | None
            The name of the counterparty that you create for an existing Revolut user via Revtag.
            Provide the value only when you specify personal for profile_type.
        individual_first_name : str | None
            The first name of the individual counterparty.
            Use when company_name isn't specified.
        individual_last_name : str | None
            The last name of the individual counterparty.
            Use when company_name isn't specified.
        bank_country : str | None
            The country of the counterparty's bank as the 2-letter ISO 3166 code.
        currency : str | None
            ISO 4217 currency code in upper case.
        revtag : str | None
            The Revtag of the counterparty to add.
        account_no : str | None
            The bank account number of the counterparty.
        iban : str | None
            The IBAN number of the counterparty's account. This field is displayed for IBAN countries.
        sort_code : str | None
            The sort code of the counterparty's bank. This field is displayed for GBP accounts.
        routing_number : str | None
            The routing number of the counterparty's bank. This field is displayed for USD accounts.
        bic : str | None
            The BIC number of the counterparty's account. This field is required for non-SEPA IBAN/SWIFT.
        clabe : str | None
            The CLABE number of the counterparty's account. This field is required for SWIFT MX.
        isfc : str | None
            The ISFC number of the counterparty's account. This field is required for INR accounts.
        bsb_code : str | None
            The BSB code of the counterparty's account. This field is required for AUD accounts.
        address_street_line1 : str | None
            Street line 1 information.
        address_street_line2 : str | None
            Street line 2 information.
        address_region : str | None
            The name of the region.
        address_city : str | None
            The name of the city.
        address_country : str | None
            The country of the counterparty's address as the 2-letter ISO 3166 code.
        address_postcode : str | None
            The postcode of the counterparty's address.

        Returns
        -------
        dict | CreateCounterparty.Response
            A dict with the information about the created counterparty.
        """
        endpoint = CreateCounterparty
        path = endpoint.ROUTE
        body = endpoint.Body(
            company_name=company_name,
            profile_type=profile_type,
            name=name,
            individual_name=(
                endpoint.Body.ModelIndividualName(
                    first_name=individual_first_name,
                    last_name=individual_last_name,
                )
                if individual_first_name is not None or individual_last_name is not None
                else None
            ),
            bank_country=bank_country,
            currency=currency,
            revtag=revtag,
            account_no=account_no,
            iban=iban,
            sort_code=sort_code,
            routing_number=routing_number,
            bic=bic,
            clabe=clabe,
            isfc=isfc,
            bsb_code=bsb_code,
            address=(
                endpoint.Body.ModelAddress(
                    street_line1=address_street_line1,
                    street_line2=address_street_line2,
                    region=address_region,
                    city=address_city,
                    country=address_country,
                    postcode=address_postcode,
                )
                if address_country is not None and address_postcode is not None
                else None
            ),
        )

        return self.client.post(
            path=path,
            response_model=endpoint.Response,
            body=body,
            **kwargs,
        )

    def validate_account_name(
        self,
        account_no: str,
        sort_code: str,
        company_name: str | None = None,
        individual_first_name: str | None = None,
        individual_last_name: str | None = None,
        **kwargs,
    ) -> dict | ValidateAccountName.Response:
        """
        Use Confirmation of Payee (CoP) to validate a UK counterparty's account name
        against their account number and sort code when adding a counterparty or making a
        transfer to a new or existing counterparty.

        Note
        ----
        Confirmation of Payee is an account name checking system in the UK that helps clients
        to make sure payments aren't sent to the wrong bank or building society account.

        When performing the check, you must specify the account type by providing the name for either
        an individual (personal account) or a company (business account).

        Caution
        -------
        The CoP check does not protect you against all kinds of fraud. It only checks if the name you provided for an account matches that account's details.
        Even if the counterparty's details match, you should still exercise due caution when transferring funds.

        This functionality is only available to UK-based businesses.

        Parameters
        ----------
        account_no : str
            The account number of the counterparty.
        sort_code : str
            The sort code of the counterparty's account.
        company_name : str | None
            The name of the business counterparty. Use when individual_name is not specified.
        individual_first_name : str | None
            The first name of the individual counterparty.
            Use when company_name isn't specified.
        individual_last_name : str | None
            The last name of the individual counterparty.
            Use when company_name isn't specified.

        Returns
        -------
        dict | ValidateAccountName.Response
            A dict with the information about the validated account name.
        """
        endpoint = ValidateAccountName
        path = endpoint.ROUTE
        body = endpoint.Body(
            account_no=account_no,
            sort_code=sort_code,
            company_name=company_name,
            individual_name=(
                endpoint.Body.ModelIndividualName(
                    first_name=individual_first_name,
                    last_name=individual_last_name,
                )
                if individual_first_name is not None or individual_last_name is not None
                else None
            ),
        )

        return self.client.post(
            path=path,
            response_model=endpoint.Response,
            body=body,
            **kwargs,
        )

    def delete_counterparty(
        self,
        counterparty_id: UUID,
        **kwargs,
    ) -> dict | DeleteCounterparty.Response:
        """Delete a counterparty with the given ID.
        When a counterparty is deleted, you cannot make any payments to the counterparty.

        Parameters
        ----------
        counterparty_id : UUID
            The ID of the counterparty to delete.

        Returns
        -------
        dict | DeleteCounterparty.Response
            An empty dict.
        """
        endpoint = DeleteCounterparty
        path = endpoint.ROUTE.format(counterparty_id=counterparty_id)
        params = endpoint.Params()

        return self.client.delete(
            path=path,
            response_model=endpoint.Response,
            params=params,
            **kwargs,
        )

create_counterparty(company_name=None, profile_type=None, name=None, individual_first_name=None, individual_last_name=None, bank_country=None, currency=None, revtag=None, account_no=None, iban=None, sort_code=None, routing_number=None, bic=None, clabe=None, isfc=None, bsb_code=None, address_street_line1=None, address_street_line2=None, address_region=None, address_city=None, address_country=None, address_postcode=None, **kwargs)

Create a new counterparty to transact with.

In the Sandbox environment, you cannot add real people and businesses as Revolut counterparties. To help you simulate Create a counterparty requests for counterparties of profile type personal, we created some test accounts. Look inside for test Revtags.

To add a counterparty via Revtag, use one of these pairs for the name and revtag fields respectively:

Test User 1 & john1pvki
Test User 2 & john2pvki
...
Test User 9 & john9pvki

Parameters:

Name Type Description Default
company_name str | None

The name of the company counterparty. Use when individual_name or name isn't specified and profile_type is business.

None
profile_type EnumProfileType | None

The type of the Revolut profile. Used when adding an existing Revolut user via Revtag.

None
name str | None

The name of the counterparty that you create for an existing Revolut user via Revtag. Provide the value only when you specify personal for profile_type.

None
individual_first_name str | None

The first name of the individual counterparty. Use when company_name isn't specified.

None
individual_last_name str | None

The last name of the individual counterparty. Use when company_name isn't specified.

None
bank_country str | None

The country of the counterparty's bank as the 2-letter ISO 3166 code.

None
currency str | None

ISO 4217 currency code in upper case.

None
revtag str | None

The Revtag of the counterparty to add.

None
account_no str | None

The bank account number of the counterparty.

None
iban str | None

The IBAN number of the counterparty's account. This field is displayed for IBAN countries.

None
sort_code str | None

The sort code of the counterparty's bank. This field is displayed for GBP accounts.

None
routing_number str | None

The routing number of the counterparty's bank. This field is displayed for USD accounts.

None
bic str | None

The BIC number of the counterparty's account. This field is required for non-SEPA IBAN/SWIFT.

None
clabe str | None

The CLABE number of the counterparty's account. This field is required for SWIFT MX.

None
isfc str | None

The ISFC number of the counterparty's account. This field is required for INR accounts.

None
bsb_code str | None

The BSB code of the counterparty's account. This field is required for AUD accounts.

None
address_street_line1 str | None

Street line 1 information.

None
address_street_line2 str | None

Street line 2 information.

None
address_region str | None

The name of the region.

None
address_city str | None

The name of the city.

None
address_country str | None

The country of the counterparty's address as the 2-letter ISO 3166 code.

None
address_postcode str | None

The postcode of the counterparty's address.

None

Returns:

Type Description
dict | Response

A dict with the information about the created counterparty.

Source code in pyrevolut/api/counterparties/endpoint/synchronous.py
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
def create_counterparty(
    self,
    company_name: str | None = None,
    profile_type: EnumProfileType | None = None,
    name: str | None = None,
    individual_first_name: str | None = None,
    individual_last_name: str | None = None,
    bank_country: str | None = None,
    currency: str | None = None,
    revtag: str | None = None,
    account_no: str | None = None,
    iban: str | None = None,
    sort_code: str | None = None,
    routing_number: str | None = None,
    bic: str | None = None,
    clabe: str | None = None,
    isfc: str | None = None,
    bsb_code: str | None = None,
    address_street_line1: str | None = None,
    address_street_line2: str | None = None,
    address_region: str | None = None,
    address_city: str | None = None,
    address_country: str | None = None,
    address_postcode: str | None = None,
    **kwargs,
) -> dict | CreateCounterparty.Response:
    """
    Create a new counterparty to transact with.

    In the Sandbox environment, you cannot add real people and businesses as Revolut counterparties.
    To help you simulate Create a counterparty requests for counterparties of profile type personal,
    we created some test accounts. Look inside for test Revtags.

    To add a counterparty via Revtag, use one of these pairs for the name and revtag fields respectively:

        Test User 1 & john1pvki
        Test User 2 & john2pvki
        ...
        Test User 9 & john9pvki

    Parameters
    ----------
    company_name : str | None
        The name of the company counterparty.
        Use when individual_name or name isn't specified and profile_type is business.
    profile_type : EnumProfileType | None
        The type of the Revolut profile. Used when adding an existing Revolut user via Revtag.
    name : str | None
        The name of the counterparty that you create for an existing Revolut user via Revtag.
        Provide the value only when you specify personal for profile_type.
    individual_first_name : str | None
        The first name of the individual counterparty.
        Use when company_name isn't specified.
    individual_last_name : str | None
        The last name of the individual counterparty.
        Use when company_name isn't specified.
    bank_country : str | None
        The country of the counterparty's bank as the 2-letter ISO 3166 code.
    currency : str | None
        ISO 4217 currency code in upper case.
    revtag : str | None
        The Revtag of the counterparty to add.
    account_no : str | None
        The bank account number of the counterparty.
    iban : str | None
        The IBAN number of the counterparty's account. This field is displayed for IBAN countries.
    sort_code : str | None
        The sort code of the counterparty's bank. This field is displayed for GBP accounts.
    routing_number : str | None
        The routing number of the counterparty's bank. This field is displayed for USD accounts.
    bic : str | None
        The BIC number of the counterparty's account. This field is required for non-SEPA IBAN/SWIFT.
    clabe : str | None
        The CLABE number of the counterparty's account. This field is required for SWIFT MX.
    isfc : str | None
        The ISFC number of the counterparty's account. This field is required for INR accounts.
    bsb_code : str | None
        The BSB code of the counterparty's account. This field is required for AUD accounts.
    address_street_line1 : str | None
        Street line 1 information.
    address_street_line2 : str | None
        Street line 2 information.
    address_region : str | None
        The name of the region.
    address_city : str | None
        The name of the city.
    address_country : str | None
        The country of the counterparty's address as the 2-letter ISO 3166 code.
    address_postcode : str | None
        The postcode of the counterparty's address.

    Returns
    -------
    dict | CreateCounterparty.Response
        A dict with the information about the created counterparty.
    """
    endpoint = CreateCounterparty
    path = endpoint.ROUTE
    body = endpoint.Body(
        company_name=company_name,
        profile_type=profile_type,
        name=name,
        individual_name=(
            endpoint.Body.ModelIndividualName(
                first_name=individual_first_name,
                last_name=individual_last_name,
            )
            if individual_first_name is not None or individual_last_name is not None
            else None
        ),
        bank_country=bank_country,
        currency=currency,
        revtag=revtag,
        account_no=account_no,
        iban=iban,
        sort_code=sort_code,
        routing_number=routing_number,
        bic=bic,
        clabe=clabe,
        isfc=isfc,
        bsb_code=bsb_code,
        address=(
            endpoint.Body.ModelAddress(
                street_line1=address_street_line1,
                street_line2=address_street_line2,
                region=address_region,
                city=address_city,
                country=address_country,
                postcode=address_postcode,
            )
            if address_country is not None and address_postcode is not None
            else None
        ),
    )

    return self.client.post(
        path=path,
        response_model=endpoint.Response,
        body=body,
        **kwargs,
    )

delete_counterparty(counterparty_id, **kwargs)

Delete a counterparty with the given ID. When a counterparty is deleted, you cannot make any payments to the counterparty.

Parameters:

Name Type Description Default
counterparty_id UUID

The ID of the counterparty to delete.

required

Returns:

Type Description
dict | Response

An empty dict.

Source code in pyrevolut/api/counterparties/endpoint/synchronous.py
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
def delete_counterparty(
    self,
    counterparty_id: UUID,
    **kwargs,
) -> dict | DeleteCounterparty.Response:
    """Delete a counterparty with the given ID.
    When a counterparty is deleted, you cannot make any payments to the counterparty.

    Parameters
    ----------
    counterparty_id : UUID
        The ID of the counterparty to delete.

    Returns
    -------
    dict | DeleteCounterparty.Response
        An empty dict.
    """
    endpoint = DeleteCounterparty
    path = endpoint.ROUTE.format(counterparty_id=counterparty_id)
    params = endpoint.Params()

    return self.client.delete(
        path=path,
        response_model=endpoint.Response,
        params=params,
        **kwargs,
    )

get_all_counterparties(name=None, account_no=None, sort_code=None, iban=None, bic=None, created_before=None, limit=None, **kwargs)

Get all the counterparties that you have created, or use the query parameters to filter the results.

The counterparties are sorted by the created_at date in reverse chronological order.

The returned counterparties are paginated. The maximum number of counterparties returned per page is specified by the limit parameter. To get to the next page, make a new request and use the created_at date of the last counterparty returned in the previous response.

Parameters:

Name Type Description Default
name str | None

The name of the counterparty to retrieve. It does not need to be an exact match, partial match is also supported.

None
account_no str | None

The exact account number of the counterparty to retrieve.

None
sort_code str | None

The exact sort code of the counterparty to retrieve. Only allowed in combination with the account_no parameter.

None
iban str | None

The exact IBAN of the counterparty to retrieve.

None
bic str | None

The exact BIC of the counterparty to retrieve. Only allowed in combination with the iban parameter.

None
created_before datetime | DateTime | str | int | float | None

Retrieves counterparties with created_at < created_before. The default value is the current date and time at which you are calling the endpoint. Provided in ISO 8601 format.

None
limit int | None

The maximum number of counterparties returned per page. To get to the next page, make a new request and use the created_at date of the last card returned in the previous response as the value for created_before.

None

Returns:

Type Description
list[dict] | list[Response]

The list of all counterparties that you have created.

Source code in pyrevolut/api/counterparties/endpoint/synchronous.py
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
def get_all_counterparties(
    self,
    name: str | None = None,
    account_no: str | None = None,
    sort_code: str | None = None,
    iban: str | None = None,
    bic: str | None = None,
    created_before: datetime | DateTime | str | int | float | None = None,
    limit: int | None = None,
    **kwargs,
) -> list[dict] | list[RetrieveListOfCounterparties.Response]:
    """
    Get all the counterparties that you have created, or use the query parameters to filter the results.

    The counterparties are sorted by the created_at date in reverse chronological order.

    The returned counterparties are paginated. The maximum number of counterparties returned per page
    is specified by the limit parameter. To get to the next page, make a new request and use the
    created_at date of the last counterparty returned in the previous response.

    Parameters
    ----------
    name : str | None
        The name of the counterparty to retrieve. It does not need to be an exact match,
        partial match is also supported.
    account_no : str | None
        The exact account number of the counterparty to retrieve.
    sort_code : str | None
        The exact sort code of the counterparty to retrieve.
        Only allowed in combination with the account_no parameter.
    iban : str | None
        The exact IBAN of the counterparty to retrieve.
    bic : str | None
        The exact BIC of the counterparty to retrieve. Only allowed in combination with the iban parameter.
    created_before : datetime | DateTime | str | int | float | None
        Retrieves counterparties with created_at < created_before.
        The default value is the current date and time at which you are calling the endpoint.
        Provided in ISO 8601 format.
    limit : int | None
        The maximum number of counterparties returned per page.
        To get to the next page, make a new request and use the
        created_at date of the last card returned in the previous
        response as the value for created_before.

    Returns
    -------
    list[dict] | list[RetrieveListOfCounterparties.Response]
        The list of all counterparties that you have created.
    """
    endpoint = RetrieveListOfCounterparties
    path = endpoint.ROUTE
    params = endpoint.Params(
        name=name,
        account_no=account_no,
        sort_code=sort_code,
        iban=iban,
        bic=bic,
        created_before=created_before,
        limit=limit,
    )

    return self.client.get(
        path=path,
        response_model=endpoint.Response,
        params=params,
        **kwargs,
    )

get_counterparty(counterparty_id, **kwargs)

Get the information about a specific counterparty by ID.

Parameters:

Name Type Description Default
counterparty_id UUID

The ID of the counterparty to retrieve.

required

Returns:

Type Description
dict | Response

The information about the counterparty.

Source code in pyrevolut/api/counterparties/endpoint/synchronous.py
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
def get_counterparty(
    self,
    counterparty_id: UUID,
    **kwargs,
) -> dict | RetrieveCounterparty.Response:
    """Get the information about a specific counterparty by ID.

    Parameters
    ----------
    counterparty_id : UUID
        The ID of the counterparty to retrieve.

    Returns
    -------
    dict | RetrieveCounterparty.Response
        The information about the counterparty.
    """
    endpoint = RetrieveCounterparty
    path = endpoint.ROUTE.format(counterparty_id=counterparty_id)
    params = endpoint.Params()

    return self.client.get(
        path=path,
        response_model=endpoint.Response,
        params=params,
        **kwargs,
    )

validate_account_name(account_no, sort_code, company_name=None, individual_first_name=None, individual_last_name=None, **kwargs)

Use Confirmation of Payee (CoP) to validate a UK counterparty's account name against their account number and sort code when adding a counterparty or making a transfer to a new or existing counterparty.

Note

Confirmation of Payee is an account name checking system in the UK that helps clients to make sure payments aren't sent to the wrong bank or building society account.

When performing the check, you must specify the account type by providing the name for either an individual (personal account) or a company (business account).

Caution

The CoP check does not protect you against all kinds of fraud. It only checks if the name you provided for an account matches that account's details. Even if the counterparty's details match, you should still exercise due caution when transferring funds.

This functionality is only available to UK-based businesses.

Parameters:

Name Type Description Default
account_no str

The account number of the counterparty.

required
sort_code str

The sort code of the counterparty's account.

required
company_name str | None

The name of the business counterparty. Use when individual_name is not specified.

None
individual_first_name str | None

The first name of the individual counterparty. Use when company_name isn't specified.

None
individual_last_name str | None

The last name of the individual counterparty. Use when company_name isn't specified.

None

Returns:

Type Description
dict | Response

A dict with the information about the validated account name.

Source code in pyrevolut/api/counterparties/endpoint/synchronous.py
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
def validate_account_name(
    self,
    account_no: str,
    sort_code: str,
    company_name: str | None = None,
    individual_first_name: str | None = None,
    individual_last_name: str | None = None,
    **kwargs,
) -> dict | ValidateAccountName.Response:
    """
    Use Confirmation of Payee (CoP) to validate a UK counterparty's account name
    against their account number and sort code when adding a counterparty or making a
    transfer to a new or existing counterparty.

    Note
    ----
    Confirmation of Payee is an account name checking system in the UK that helps clients
    to make sure payments aren't sent to the wrong bank or building society account.

    When performing the check, you must specify the account type by providing the name for either
    an individual (personal account) or a company (business account).

    Caution
    -------
    The CoP check does not protect you against all kinds of fraud. It only checks if the name you provided for an account matches that account's details.
    Even if the counterparty's details match, you should still exercise due caution when transferring funds.

    This functionality is only available to UK-based businesses.

    Parameters
    ----------
    account_no : str
        The account number of the counterparty.
    sort_code : str
        The sort code of the counterparty's account.
    company_name : str | None
        The name of the business counterparty. Use when individual_name is not specified.
    individual_first_name : str | None
        The first name of the individual counterparty.
        Use when company_name isn't specified.
    individual_last_name : str | None
        The last name of the individual counterparty.
        Use when company_name isn't specified.

    Returns
    -------
    dict | ValidateAccountName.Response
        A dict with the information about the validated account name.
    """
    endpoint = ValidateAccountName
    path = endpoint.ROUTE
    body = endpoint.Body(
        account_no=account_no,
        sort_code=sort_code,
        company_name=company_name,
        individual_name=(
            endpoint.Body.ModelIndividualName(
                first_name=individual_first_name,
                last_name=individual_last_name,
            )
            if individual_first_name is not None or individual_last_name is not None
            else None
        ),
    )

    return self.client.post(
        path=path,
        response_model=endpoint.Response,
        body=body,
        **kwargs,
    )