Counterparties Asynchronous Endpoints
This Counterparties
endpoint provides asynchronous methods to interact with the counterparties of the authenticated user.
Example usage of the Counterparties endpoint object:
import asyncio
from pyrevolut.client import AsyncClient
CREDS_JSON_LOC = "path/to/creds.json"
client = AsyncClient(
creds_loc=CREDS_JSON_LOC,
sandbox=True,
)
async def run():
async with client:
counterparties = await client.Counterparties.get_all_counterparties()
print(counterparties)
asyncio.run(run())
EndpointCounterpartiesAsync
Bases: BaseEndpointAsync
The async 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/asynchronous.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 373 |
|
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)
async
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/asynchronous.py
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 |
|
delete_counterparty(counterparty_id, **kwargs)
async
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/asynchronous.py
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 373 |
|
get_all_counterparties(name=None, account_no=None, sort_code=None, iban=None, bic=None, created_before=None, limit=None, **kwargs)
async
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/asynchronous.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 |
|
get_counterparty(counterparty_id, **kwargs)
async
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/asynchronous.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 130 |
|
validate_account_name(account_no, sort_code, company_name=None, individual_first_name=None, individual_last_name=None, **kwargs)
async
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/asynchronous.py
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 |
|