Skip to content

Transfers Pydantic Models

In order to simplify and standardize the data that is passed between the client and the Revolut Business API, PyRevolut uses Pydantic models to define the structure of the data. Below are the Pydantic models used by the Transfers endpoint.


ResourceTransfer

Bases: BaseModel

Transfer resource model.

Source code in pyrevolut/api/transfers/resources/transfer.py
 9
10
11
12
13
14
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
class ResourceTransfer(BaseModel):
    """
    Transfer resource model.
    """

    id: Annotated[str, Field(description="The ID of the transaction created.")]
    state: Annotated[
        EnumTransactionState,
        Field(
            description="""
            Indicates the transaction state. Possible values:

            created:
                The transaction has been created and is either processed asynchronously
                or scheduled for a later time.
            pending:
                The transaction is pending until it's being processed.
                If the transfer is made between Revolut accounts,
                this state is skipped and the transaction is executed instantly.
            completed:
                The transaction was successful.
            declined:
                The transaction was unsuccessful. This can happen for a variety of reasons,
                for example, insufficient account balance, wrong receiver information, etc.
            failed:
                The transaction was unsuccessful. This can happen for a variety of reasons,
                for example, invalid API calls, blocked payments, etc.
            reverted:
                The transaction was reverted. This can happen for a variety of reasons,
                for example, the receiver being inaccessible.
            """
        ),
    ]
    created_at: Annotated[
        DateTime,
        Field(
            description="The date and time the transaction was created in ISO 8601 format."
        ),
    ]
    completed_at: Annotated[
        DateTime | None,
        Field(
            description="The date and time the transaction was completed in ISO 8601 format."
        ),
    ] = None

GetTransferReasons

In order to initiate a transfer in certain currencies and countries, you must provide a transfer reason. With this endpoint you can retrieve all transfer reasons available to your business account per country and currency.

After you retrieve the results, use the appropriate reason code in the transfer_reason_code field when making a transfer to a counterparty or creating a payout link.

Source code in pyrevolut/api/transfers/get/get_transfer_reasons.py
10
11
12
13
14
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
class GetTransferReasons:
    """
    In order to initiate a transfer in certain currencies and countries,
    you must provide a transfer reason.
    With this endpoint you can retrieve all transfer reasons available to your business account
    per country and currency.

    After you retrieve the results, use the appropriate reason code in the transfer_reason_code
    field when making a transfer to a counterparty or creating a payout link.
    """

    ROUTE = "/1.0/transfer-reasons"

    class Params(BaseModel):
        """
        The query parameters for the request.
        """

        pass

    class Response(BaseModel):
        """
        The response model for the request.
        """

        country: Annotated[
            CountryAlpha2,
            Field(
                description="""
                The bank country of the counterparty as the 2-letter ISO 3166 code.
                """,
            ),
        ]
        currency: Annotated[
            Currency,
            Field(
                description="""
                ISO 4217 currency code in upper case.
                """,
            ),
        ]
        code: Annotated[
            EnumTransferReasonCode,
            Field(
                description="""
                Category name of the transfer reason.
                """,
            ),
        ]
        description: Annotated[
            str,
            Field(
                description="""
                The description of the given transfer reason.
                """,
            ),
        ]

Params

Bases: BaseModel

The query parameters for the request.

Source code in pyrevolut/api/transfers/get/get_transfer_reasons.py
23
24
25
26
27
28
class Params(BaseModel):
    """
    The query parameters for the request.
    """

    pass

Response

Bases: BaseModel

The response model for the request.

Source code in pyrevolut/api/transfers/get/get_transfer_reasons.py
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
class Response(BaseModel):
    """
    The response model for the request.
    """

    country: Annotated[
        CountryAlpha2,
        Field(
            description="""
            The bank country of the counterparty as the 2-letter ISO 3166 code.
            """,
        ),
    ]
    currency: Annotated[
        Currency,
        Field(
            description="""
            ISO 4217 currency code in upper case.
            """,
        ),
    ]
    code: Annotated[
        EnumTransferReasonCode,
        Field(
            description="""
            Category name of the transfer reason.
            """,
        ),
    ]
    description: Annotated[
        str,
        Field(
            description="""
            The description of the given transfer reason.
            """,
        ),
    ]

CreateTransferToAnotherAccount

Make a payment to a counterparty. The resulting transaction has the type transfer.

If you make the payment to another Revolut account, either business or personal, the transaction is executed instantly.

If the counterparty has multiple payment methods available, for example, 2 accounts, or 1 account and 1 card, you must specify the account or card to which you want to transfer the money (receiver.account_id or receiver.card_id respectively).

Caution

Due to PSD2 Strong Customer Authentication regulations, this endpoint is only available for customers on Revolut Business Company plans. If you're a freelancer and wish to make payments via our API, we advise that you instead leverage our Payment drafts (/payment-drafts) endpoint.

Source code in pyrevolut/api/transfers/post/create_transfer_to_another_account.py
 11
 12
 13
 14
 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
class CreateTransferToAnotherAccount:
    """
    Make a payment to a counterparty.
    The resulting transaction has the type transfer.

    If you make the payment to another Revolut account, either business or personal,
    the transaction is executed instantly.

    If the counterparty has multiple payment methods available, for example, 2 accounts,
    or 1 account and 1 card, you must specify the account or card to which you want to
    transfer the money (receiver.account_id or receiver.card_id respectively).

    Caution
    -------
    Due to PSD2 Strong Customer Authentication regulations, this endpoint is
    only available for customers on Revolut Business Company plans. If you're a
    freelancer and wish to make payments via our API, we advise that you instead
    leverage our Payment drafts (/payment-drafts) endpoint.
    """

    ROUTE = "/1.0/pay"

    class Body(BaseModel):
        """
        The body of the request.
        """

        class ModelReceiver(BaseModel):
            """
            The details of the transfer recipient.

            If the counterparty has multiple payment methods available
            (e.g. 2 accounts, or 1 account and 1 card), you must specify the account
            (account_id) or card (card_id) to which you want to transfer the money.
            """

            counterparty_id: Annotated[
                UUID,
                Field(description="The ID of the receiving counterparty."),
            ]
            account_id: Annotated[
                UUID | None,
                Field(
                    description="""
                    The ID of the receiving counterparty's account, which can be own account. 
                    Used for bank transfers.

                    If the counterparty has multiple payment methods available, use it to 
                    specify the account to which you want to send the money.
                    """,
                ),
            ] = None
            card_id: Annotated[
                UUID | None,
                Field(
                    description="""
                    The ID of the receiving counterparty's card. Used for card transfers.

                    If the counterparty has multiple payment methods available, use it to 
                    specify the card to which you want to send the money.
                    """,
                ),
            ] = None

        request_id: Annotated[
            str,
            Field(
                description="""
                The ID of the request, provided by you. 
                It helps you identify the transaction in your system.
                To ensure that a transfer is not processed multiple times if 
                there are network or system errors, the same request_id should be used 
                for requests related to the same transfer.
                """,
                max_length=40,
            ),
        ]
        account_id: Annotated[
            UUID,
            Field(description="The ID of the account that you send the funds from."),
        ]
        receiver: Annotated[
            ModelReceiver,
            Field(
                description="""
                The details of the transfer recipient.

                If the counterparty has multiple payment methods available
                (e.g. 2 accounts, or 1 account and 1 card), you must specify the account
                (account_id) or card (card_id) to which you want to transfer the money.
                """
            ),
        ]
        amount: Annotated[
            float,
            Field(
                description="The amount of the funds to be transferred.",
                gt=0,
            ),
        ]
        currency: Annotated[
            Currency,
            Field(description="The ISO 4217 currency of the funds to be transferred."),
        ]
        reference: Annotated[
            str | None,
            Field(
                description="""
                The reference for the transaction.
                """,
            ),
        ] = None
        charge_bearer: Annotated[
            EnumChargeBearer | None,
            Field(
                description="""
                The party to which any transaction fees are charged if the resulting 
                transaction route has associated fees. Some transactions with fees might 
                not be possible with the specified option, in which case error 3287 is returned.

                Possible values:
                - shared: The transaction fees are shared between the sender and the receiver.
                - debtor: The sender pays the transaction fees.
                """,
            ),
        ] = None
        transfer_reason_code: Annotated[
            EnumTransferReasonCode | None,
            Field(
                description="""
                The reason code for the transaction. 
                Transactions to certain countries and currencies might require 
                you to provide a transfer reason. 
                You can check available reason codes with the getTransferReasons operation.

                If a transfer reason is not required for the given currency and country, 
                this field is ignored.
                """,
            ),
        ] = None

    class Response(ResourceTransfer):
        """
        The response model of the request.
        """

        pass

Body

Bases: BaseModel

The body of the request.

Source code in pyrevolut/api/transfers/post/create_transfer_to_another_account.py
 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
class Body(BaseModel):
    """
    The body of the request.
    """

    class ModelReceiver(BaseModel):
        """
        The details of the transfer recipient.

        If the counterparty has multiple payment methods available
        (e.g. 2 accounts, or 1 account and 1 card), you must specify the account
        (account_id) or card (card_id) to which you want to transfer the money.
        """

        counterparty_id: Annotated[
            UUID,
            Field(description="The ID of the receiving counterparty."),
        ]
        account_id: Annotated[
            UUID | None,
            Field(
                description="""
                The ID of the receiving counterparty's account, which can be own account. 
                Used for bank transfers.

                If the counterparty has multiple payment methods available, use it to 
                specify the account to which you want to send the money.
                """,
            ),
        ] = None
        card_id: Annotated[
            UUID | None,
            Field(
                description="""
                The ID of the receiving counterparty's card. Used for card transfers.

                If the counterparty has multiple payment methods available, use it to 
                specify the card to which you want to send the money.
                """,
            ),
        ] = None

    request_id: Annotated[
        str,
        Field(
            description="""
            The ID of the request, provided by you. 
            It helps you identify the transaction in your system.
            To ensure that a transfer is not processed multiple times if 
            there are network or system errors, the same request_id should be used 
            for requests related to the same transfer.
            """,
            max_length=40,
        ),
    ]
    account_id: Annotated[
        UUID,
        Field(description="The ID of the account that you send the funds from."),
    ]
    receiver: Annotated[
        ModelReceiver,
        Field(
            description="""
            The details of the transfer recipient.

            If the counterparty has multiple payment methods available
            (e.g. 2 accounts, or 1 account and 1 card), you must specify the account
            (account_id) or card (card_id) to which you want to transfer the money.
            """
        ),
    ]
    amount: Annotated[
        float,
        Field(
            description="The amount of the funds to be transferred.",
            gt=0,
        ),
    ]
    currency: Annotated[
        Currency,
        Field(description="The ISO 4217 currency of the funds to be transferred."),
    ]
    reference: Annotated[
        str | None,
        Field(
            description="""
            The reference for the transaction.
            """,
        ),
    ] = None
    charge_bearer: Annotated[
        EnumChargeBearer | None,
        Field(
            description="""
            The party to which any transaction fees are charged if the resulting 
            transaction route has associated fees. Some transactions with fees might 
            not be possible with the specified option, in which case error 3287 is returned.

            Possible values:
            - shared: The transaction fees are shared between the sender and the receiver.
            - debtor: The sender pays the transaction fees.
            """,
        ),
    ] = None
    transfer_reason_code: Annotated[
        EnumTransferReasonCode | None,
        Field(
            description="""
            The reason code for the transaction. 
            Transactions to certain countries and currencies might require 
            you to provide a transfer reason. 
            You can check available reason codes with the getTransferReasons operation.

            If a transfer reason is not required for the given currency and country, 
            this field is ignored.
            """,
        ),
    ] = None

ModelReceiver

Bases: BaseModel

The details of the transfer recipient.

If the counterparty has multiple payment methods available (e.g. 2 accounts, or 1 account and 1 card), you must specify the account (account_id) or card (card_id) to which you want to transfer the money.

Source code in pyrevolut/api/transfers/post/create_transfer_to_another_account.py
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
class ModelReceiver(BaseModel):
    """
    The details of the transfer recipient.

    If the counterparty has multiple payment methods available
    (e.g. 2 accounts, or 1 account and 1 card), you must specify the account
    (account_id) or card (card_id) to which you want to transfer the money.
    """

    counterparty_id: Annotated[
        UUID,
        Field(description="The ID of the receiving counterparty."),
    ]
    account_id: Annotated[
        UUID | None,
        Field(
            description="""
            The ID of the receiving counterparty's account, which can be own account. 
            Used for bank transfers.

            If the counterparty has multiple payment methods available, use it to 
            specify the account to which you want to send the money.
            """,
        ),
    ] = None
    card_id: Annotated[
        UUID | None,
        Field(
            description="""
            The ID of the receiving counterparty's card. Used for card transfers.

            If the counterparty has multiple payment methods available, use it to 
            specify the card to which you want to send the money.
            """,
        ),
    ] = None

Response

Bases: ResourceTransfer

The response model of the request.

Source code in pyrevolut/api/transfers/post/create_transfer_to_another_account.py
152
153
154
155
156
157
class Response(ResourceTransfer):
    """
    The response model of the request.
    """

    pass

MoveMoneyBetweenAccounts

Move money between the Revolut accounts of the business in the same currency.

The resulting transaction has the type transfer.

Source code in pyrevolut/api/transfers/post/move_money_between_accounts.py
10
11
12
13
14
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
class MoveMoneyBetweenAccounts:
    """
    Move money between the Revolut accounts of the business in the same currency.

    The resulting transaction has the type transfer.
    """

    ROUTE = "/1.0/transfer"

    class Body(BaseModel):
        """
        The body of the request.
        """

        request_id: Annotated[
            str,
            Field(
                description="""
                The ID of the request, provided by you. 
                It helps you identify the transaction in your system.
                To ensure that a transfer is not processed multiple times if 
                there are network or system errors, the same request_id should be used 
                for requests related to the same transfer.
                """,
                max_length=40,
            ),
        ]
        source_account_id: Annotated[
            UUID,
            Field(
                description="The ID of the source account that you transfer the funds from."
            ),
        ]
        target_account_id: Annotated[
            UUID,
            Field(
                description="The ID of the target account that you transfer the funds to."
            ),
        ]
        amount: Annotated[
            float,
            Field(
                description="The amount of the funds to be transferred.",
                gt=0,
            ),
        ]
        currency: Annotated[
            Currency,
            Field(description="The ISO 4217 currency of the funds to be transferred."),
        ]
        reference: Annotated[
            str | None,
            Field(
                description="""
                The reference for the funds transfer.
                """,
            ),
        ] = None

    class Response(ResourceTransfer):
        """
        The response model of the request.
        """

        pass

Body

Bases: BaseModel

The body of the request.

Source code in pyrevolut/api/transfers/post/move_money_between_accounts.py
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
class Body(BaseModel):
    """
    The body of the request.
    """

    request_id: Annotated[
        str,
        Field(
            description="""
            The ID of the request, provided by you. 
            It helps you identify the transaction in your system.
            To ensure that a transfer is not processed multiple times if 
            there are network or system errors, the same request_id should be used 
            for requests related to the same transfer.
            """,
            max_length=40,
        ),
    ]
    source_account_id: Annotated[
        UUID,
        Field(
            description="The ID of the source account that you transfer the funds from."
        ),
    ]
    target_account_id: Annotated[
        UUID,
        Field(
            description="The ID of the target account that you transfer the funds to."
        ),
    ]
    amount: Annotated[
        float,
        Field(
            description="The amount of the funds to be transferred.",
            gt=0,
        ),
    ]
    currency: Annotated[
        Currency,
        Field(description="The ISO 4217 currency of the funds to be transferred."),
    ]
    reference: Annotated[
        str | None,
        Field(
            description="""
            The reference for the funds transfer.
            """,
        ),
    ] = None

Response

Bases: ResourceTransfer

The response model of the request.

Source code in pyrevolut/api/transfers/post/move_money_between_accounts.py
69
70
71
72
73
74
class Response(ResourceTransfer):
    """
    The response model of the request.
    """

    pass