Skip to content

Cards 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 Cards endpoint.


ResourceCard

Bases: BaseModel

Card resource model

Source code in pyrevolut/api/cards/resources/card.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
 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
class ResourceCard(BaseModel):
    """
    Card resource model
    """

    class ModelSpendingLimits(BaseModel):
        """All spending limits set for the card."""

        class ModelSingle(ModelBaseAmount):
            """The limit for a single transaction."""

            pass

        class ModelDay(ModelBaseAmount):
            """The daily limit for transactions."""

            pass

        class ModelWeek(ModelBaseAmount):
            """The weekly limit for transactions."""

            pass

        class ModelMonth(ModelBaseAmount):
            """The monthly limit for transactions."""

            pass

        class ModelQuarter(ModelBaseAmount):
            """The quarterly limit for transactions."""

            pass

        class ModelYear(ModelBaseAmount):
            """The yearly limit for transactions."""

            pass

        class ModelAllTime(ModelBaseAmount):
            """The all-time limit for transactions."""

            pass

        single: Annotated[
            ModelSingle | None,
            Field(description="The limit for a single transaction."),
        ]
        day: Annotated[
            ModelDay | None,
            Field(description="The daily limit for transactions."),
        ]
        week: Annotated[
            ModelWeek | None,
            Field(description="The weekly limit for transactions."),
        ]
        month: Annotated[
            ModelMonth | None,
            Field(description="The monthly limit for transactions."),
        ]
        quarter: Annotated[
            ModelQuarter | None,
            Field(description="The quarterly limit for transactions."),
        ]
        year: Annotated[
            ModelYear | None,
            Field(description="The yearly limit for transactions."),
        ]
        all_time: Annotated[
            ModelAllTime | None,
            Field(description="The all-time limit for transactions."),
        ]

    id: Annotated[
        UUID,
        Field(description="The ID of the card."),
    ]
    last_digits: Annotated[
        str,
        Field(description="The last 4 digits of the card's PAN."),
    ]
    expiry: Annotated[
        Date,
        Field(description="The card expiration date."),
    ]
    state: Annotated[
        EnumCardState,
        Field(description="The state that the card is in."),
    ]
    label: Annotated[
        str | None,
        Field(description="The label of the card."),
    ]
    virtual: Annotated[
        bool,
        Field(
            description="Specifies whether the card is virtual (true) or physical (false)."
        ),
    ]
    accounts: Annotated[
        list[UUID],
        Field(description="The list of linked accounts."),
    ]
    categories: Annotated[
        list[EnumMerchantCategory] | None,
        Field(
            description="""
            The list of merchant categories that are available for card spending. 
            If not specified, all categories will be allowed.  
            """
        ),
    ]
    spending_limits: Annotated[
        ModelSpendingLimits | None,
        Field(description="All spending limits set for the card."),
    ]
    holder_id: Annotated[
        UUID | None,
        Field(
            description="""
            The ID of the team member who is the holder of the card. 
            If the card belongs to the business, this will be empty.
            """
        ),
    ]
    created_at: Annotated[
        DateTime,
        Field(description="The date and time the card was created in ISO 8601 format."),
    ]
    updated_at: Annotated[
        DateTime,
        Field(
            description="The date and time the card was last updated in ISO 8601 format."
        ),
    ]

ModelSpendingLimits

Bases: BaseModel

All spending limits set for the card.

Source code in pyrevolut/api/cards/resources/card.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
class ModelSpendingLimits(BaseModel):
    """All spending limits set for the card."""

    class ModelSingle(ModelBaseAmount):
        """The limit for a single transaction."""

        pass

    class ModelDay(ModelBaseAmount):
        """The daily limit for transactions."""

        pass

    class ModelWeek(ModelBaseAmount):
        """The weekly limit for transactions."""

        pass

    class ModelMonth(ModelBaseAmount):
        """The monthly limit for transactions."""

        pass

    class ModelQuarter(ModelBaseAmount):
        """The quarterly limit for transactions."""

        pass

    class ModelYear(ModelBaseAmount):
        """The yearly limit for transactions."""

        pass

    class ModelAllTime(ModelBaseAmount):
        """The all-time limit for transactions."""

        pass

    single: Annotated[
        ModelSingle | None,
        Field(description="The limit for a single transaction."),
    ]
    day: Annotated[
        ModelDay | None,
        Field(description="The daily limit for transactions."),
    ]
    week: Annotated[
        ModelWeek | None,
        Field(description="The weekly limit for transactions."),
    ]
    month: Annotated[
        ModelMonth | None,
        Field(description="The monthly limit for transactions."),
    ]
    quarter: Annotated[
        ModelQuarter | None,
        Field(description="The quarterly limit for transactions."),
    ]
    year: Annotated[
        ModelYear | None,
        Field(description="The yearly limit for transactions."),
    ]
    all_time: Annotated[
        ModelAllTime | None,
        Field(description="The all-time limit for transactions."),
    ]

ModelAllTime

Bases: ModelBaseAmount

The all-time limit for transactions.

Source code in pyrevolut/api/cards/resources/card.py
48
49
50
51
class ModelAllTime(ModelBaseAmount):
    """The all-time limit for transactions."""

    pass

ModelDay

Bases: ModelBaseAmount

The daily limit for transactions.

Source code in pyrevolut/api/cards/resources/card.py
23
24
25
26
class ModelDay(ModelBaseAmount):
    """The daily limit for transactions."""

    pass

ModelMonth

Bases: ModelBaseAmount

The monthly limit for transactions.

Source code in pyrevolut/api/cards/resources/card.py
33
34
35
36
class ModelMonth(ModelBaseAmount):
    """The monthly limit for transactions."""

    pass

ModelQuarter

Bases: ModelBaseAmount

The quarterly limit for transactions.

Source code in pyrevolut/api/cards/resources/card.py
38
39
40
41
class ModelQuarter(ModelBaseAmount):
    """The quarterly limit for transactions."""

    pass

ModelSingle

Bases: ModelBaseAmount

The limit for a single transaction.

Source code in pyrevolut/api/cards/resources/card.py
18
19
20
21
class ModelSingle(ModelBaseAmount):
    """The limit for a single transaction."""

    pass

ModelWeek

Bases: ModelBaseAmount

The weekly limit for transactions.

Source code in pyrevolut/api/cards/resources/card.py
28
29
30
31
class ModelWeek(ModelBaseAmount):
    """The weekly limit for transactions."""

    pass

ModelYear

Bases: ModelBaseAmount

The yearly limit for transactions.

Source code in pyrevolut/api/cards/resources/card.py
43
44
45
46
class ModelYear(ModelBaseAmount):
    """The yearly limit for transactions."""

    pass

RetrieveListOfCards

Get the list of all cards in your organisation. The results are paginated and sorted by the created_at date in reverse chronological order.

Source code in pyrevolut/api/cards/get/retrieve_list_of_cards.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 RetrieveListOfCards:
    """
    Get the list of all cards in your organisation.
    The results are paginated and sorted by the created_at date in reverse chronological order.
    """

    ROUTE = "/1.0/cards"

    class Params(BaseModel):
        """
        Query parameters for the endpoint.
        """

        created_before: Annotated[
            DateTime | None,
            Field(
                description="""
                Retrieves cards 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: Annotated[
            int | None,
            Field(
                description="""
                The maximum number of cards 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.              

                If not provided, the default value is 100.  
                """,
                ge=1,
                le=100,
            ),
        ] = None

    class Response(ResourceCard):
        """
        Response model for the endpoint.
        """

        pass

Params

Bases: BaseModel

Query parameters for the endpoint.

Source code in pyrevolut/api/cards/get/retrieve_list_of_cards.py
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
class Params(BaseModel):
    """
    Query parameters for the endpoint.
    """

    created_before: Annotated[
        DateTime | None,
        Field(
            description="""
            Retrieves cards 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: Annotated[
        int | None,
        Field(
            description="""
            The maximum number of cards 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.              

            If not provided, the default value is 100.  
            """,
            ge=1,
            le=100,
        ),
    ] = None

Response

Bases: ResourceCard

Response model for the endpoint.

Source code in pyrevolut/api/cards/get/retrieve_list_of_cards.py
48
49
50
51
52
53
class Response(ResourceCard):
    """
    Response model for the endpoint.
    """

    pass

RetrieveCardDetails

Get the details of a specific card, based on its ID.

Source code in pyrevolut/api/cards/get/retrieve_card_details.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class RetrieveCardDetails:
    """
    Get the details of a specific card, based on its ID.
    """

    ROUTE = "/1.0/cards/{card_id}"

    class Params(BaseModel):
        """
        Query parameters for the endpoint.
        """

        pass

    class Response(ResourceCard):
        """
        Response model for the endpoint.
        """

        pass

Params

Bases: BaseModel

Query parameters for the endpoint.

Source code in pyrevolut/api/cards/get/retrieve_card_details.py
13
14
15
16
17
18
class Params(BaseModel):
    """
    Query parameters for the endpoint.
    """

    pass

Response

Bases: ResourceCard

Response model for the endpoint.

Source code in pyrevolut/api/cards/get/retrieve_card_details.py
20
21
22
23
24
25
class Response(ResourceCard):
    """
    Response model for the endpoint.
    """

    pass

RetrieveSensitiveCardDetails

Get sensitive details of a specific card, based on its ID. Requires the READ_SENSITIVE_CARD_DATA token scope.

Source code in pyrevolut/api/cards/get/retrieve_sensitive_card_details.py
 8
 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
class RetrieveSensitiveCardDetails:
    """
    Get sensitive details of a specific card, based on its ID.
    Requires the READ_SENSITIVE_CARD_DATA token scope.
    """

    ROUTE = "/1.0/cards/{card_id}/sensitive-details"

    class Params(BaseModel):
        """
        Query parameters for the endpoint.
        """

        pass

    class Response(BaseModel):
        """
        Response model for the endpoint.
        """

        pan: Annotated[
            str, Field(description="The PAN (Primary Account Number) of the card.")
        ]
        cvv: Annotated[
            str, Field(description="The CVV (Card Verification Value) of the card.")
        ]
        expiry: Annotated[Date, Field(description="The card expiration date.")]

Params

Bases: BaseModel

Query parameters for the endpoint.

Source code in pyrevolut/api/cards/get/retrieve_sensitive_card_details.py
16
17
18
19
20
21
class Params(BaseModel):
    """
    Query parameters for the endpoint.
    """

    pass

Response

Bases: BaseModel

Response model for the endpoint.

Source code in pyrevolut/api/cards/get/retrieve_sensitive_card_details.py
23
24
25
26
27
28
29
30
31
32
33
34
class Response(BaseModel):
    """
    Response model for the endpoint.
    """

    pan: Annotated[
        str, Field(description="The PAN (Primary Account Number) of the card.")
    ]
    cvv: Annotated[
        str, Field(description="The CVV (Card Verification Value) of the card.")
    ]
    expiry: Annotated[Date, Field(description="The card expiration date.")]

CreateCard

Create a new card for an existing member of your Revolut Business team.

When using the API, you can create only virtual cards. To create a physical card, use the Revolut Business app.

Source code in pyrevolut/api/cards/post/create_card.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
 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
class CreateCard:
    """
    Create a new card for an existing member of your Revolut Business team.

    When using the API, you can create only virtual cards.
    To create a physical card, use the Revolut Business app.
    """

    ROUTE = "/1.0/cards"

    class Body(BaseModel):
        """
        Body model for the endpoint.
        """

        class ModelSpendingLimits(BaseModel):
            """All spending limits set for the card."""

            class ModelSingle(ModelBaseAmount):
                """The limit for a single transaction."""

                pass

            class ModelDay(ModelBaseAmount):
                """The daily limit for transactions."""

                pass

            class ModelWeek(ModelBaseAmount):
                """The weekly limit for transactions."""

                pass

            class ModelMonth(ModelBaseAmount):
                """The monthly limit for transactions."""

                pass

            class ModelQuarter(ModelBaseAmount):
                """The quarterly limit for transactions."""

                pass

            class ModelYear(ModelBaseAmount):
                """The yearly limit for transactions."""

                pass

            class ModelAllTime(ModelBaseAmount):
                """The all-time limit for transactions."""

                pass

            single: Annotated[
                ModelSingle | None,
                Field(description="The limit for a single transaction."),
            ]
            day: Annotated[
                ModelDay | None,
                Field(description="The daily limit for transactions."),
            ]
            week: Annotated[
                ModelWeek | None,
                Field(description="The weekly limit for transactions."),
            ]
            month: Annotated[
                ModelMonth | None,
                Field(description="The monthly limit for transactions."),
            ]
            quarter: Annotated[
                ModelQuarter | None,
                Field(description="The quarterly limit for transactions."),
            ]
            year: Annotated[
                ModelYear | None,
                Field(description="The yearly limit for transactions."),
            ]
            all_time: Annotated[
                ModelAllTime | None,
                Field(description="The all-time limit for transactions."),
            ]

        request_id: Annotated[
            str,
            Field(
                description="""
                A unique ID of the request that you provide.
                This ID is used to prevent duplicate card creation requests in case 
                of a lost connection or client error, so make sure you use the same 
                request_id for requests related to the same card.
                The deduplication is limited to 24 hours counting from the first request 
                using a given ID. 
                """,
                max_length=40,
            ),
        ]
        virtual: Annotated[
            bool,
            Field(
                description="""
                Specifies the type of the card. Must be set to true, as with the API, you can create only virtual cards.
                """,
            ),
        ] = True
        holder_id: Annotated[
            UUID,
            Field(
                description="""
                The ID of the team member who will be the holder of the card.
                """
            ),
        ]
        label: Annotated[
            str | None,
            Field(
                description="""
                The label for the issued card, displayed in the UI to help distinguish between cards. 
                If not specified, no label will be added.
                """,
                max_length=30,
            ),
        ] = None
        accounts: Annotated[
            list[UUID] | None,
            Field(
                description="""
                The list of accounts to link to the card. If not specified, all accounts will be linked.
                """,
            ),
        ] = None
        categories: Annotated[
            list[EnumMerchantCategory] | None,
            Field(
                description="""
                The list of merchant categories to be available for card spending. 
                If not specified, all categories will be allowed.
                """,
            ),
        ] = None
        spending_limits: Annotated[
            ModelSpendingLimits | None,
            Field(
                description="""
                All spending limits set for the card.
                You can have at most 1 periodic (day/week/month/quarter/all-time) and 
                1 non-periodic (single transaction) limit at a time. 
                If you try to specify 2 periodic limits at a time, it will result in an error.

                Spending limit currency must match the default business currency. 
                The default currency was assigned to your business during onboarding.
                """,
            ),
        ] = None

        @model_validator(mode="after")
        def check_inputs(self) -> "CreateCard.Body":
            """Check the inputs."""
            if not self.virtual:
                raise ValueError("You can only create virtual cards via the API.")
            if self.spending_limits is not None:
                if (
                    sum(
                        [
                            self.spending_limits.day is not None,
                            self.spending_limits.week is not None,
                            self.spending_limits.month is not None,
                            self.spending_limits.quarter is not None,
                            self.spending_limits.year is not None,
                            self.spending_limits.all_time is not None,
                        ]
                    )
                    > 1
                ):
                    raise ValueError(
                        "You can have at most 1 periodic (day/week/month/quarter/all-time) limit at a time."
                    )
            return self

    class Response(ResourceCard):
        """
        Response model for the endpoint.
        """

        pass

Body

Bases: BaseModel

Body model for the endpoint.

Source code in pyrevolut/api/cards/post/create_card.py
 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
class Body(BaseModel):
    """
    Body model for the endpoint.
    """

    class ModelSpendingLimits(BaseModel):
        """All spending limits set for the card."""

        class ModelSingle(ModelBaseAmount):
            """The limit for a single transaction."""

            pass

        class ModelDay(ModelBaseAmount):
            """The daily limit for transactions."""

            pass

        class ModelWeek(ModelBaseAmount):
            """The weekly limit for transactions."""

            pass

        class ModelMonth(ModelBaseAmount):
            """The monthly limit for transactions."""

            pass

        class ModelQuarter(ModelBaseAmount):
            """The quarterly limit for transactions."""

            pass

        class ModelYear(ModelBaseAmount):
            """The yearly limit for transactions."""

            pass

        class ModelAllTime(ModelBaseAmount):
            """The all-time limit for transactions."""

            pass

        single: Annotated[
            ModelSingle | None,
            Field(description="The limit for a single transaction."),
        ]
        day: Annotated[
            ModelDay | None,
            Field(description="The daily limit for transactions."),
        ]
        week: Annotated[
            ModelWeek | None,
            Field(description="The weekly limit for transactions."),
        ]
        month: Annotated[
            ModelMonth | None,
            Field(description="The monthly limit for transactions."),
        ]
        quarter: Annotated[
            ModelQuarter | None,
            Field(description="The quarterly limit for transactions."),
        ]
        year: Annotated[
            ModelYear | None,
            Field(description="The yearly limit for transactions."),
        ]
        all_time: Annotated[
            ModelAllTime | None,
            Field(description="The all-time limit for transactions."),
        ]

    request_id: Annotated[
        str,
        Field(
            description="""
            A unique ID of the request that you provide.
            This ID is used to prevent duplicate card creation requests in case 
            of a lost connection or client error, so make sure you use the same 
            request_id for requests related to the same card.
            The deduplication is limited to 24 hours counting from the first request 
            using a given ID. 
            """,
            max_length=40,
        ),
    ]
    virtual: Annotated[
        bool,
        Field(
            description="""
            Specifies the type of the card. Must be set to true, as with the API, you can create only virtual cards.
            """,
        ),
    ] = True
    holder_id: Annotated[
        UUID,
        Field(
            description="""
            The ID of the team member who will be the holder of the card.
            """
        ),
    ]
    label: Annotated[
        str | None,
        Field(
            description="""
            The label for the issued card, displayed in the UI to help distinguish between cards. 
            If not specified, no label will be added.
            """,
            max_length=30,
        ),
    ] = None
    accounts: Annotated[
        list[UUID] | None,
        Field(
            description="""
            The list of accounts to link to the card. If not specified, all accounts will be linked.
            """,
        ),
    ] = None
    categories: Annotated[
        list[EnumMerchantCategory] | None,
        Field(
            description="""
            The list of merchant categories to be available for card spending. 
            If not specified, all categories will be allowed.
            """,
        ),
    ] = None
    spending_limits: Annotated[
        ModelSpendingLimits | None,
        Field(
            description="""
            All spending limits set for the card.
            You can have at most 1 periodic (day/week/month/quarter/all-time) and 
            1 non-periodic (single transaction) limit at a time. 
            If you try to specify 2 periodic limits at a time, it will result in an error.

            Spending limit currency must match the default business currency. 
            The default currency was assigned to your business during onboarding.
            """,
        ),
    ] = None

    @model_validator(mode="after")
    def check_inputs(self) -> "CreateCard.Body":
        """Check the inputs."""
        if not self.virtual:
            raise ValueError("You can only create virtual cards via the API.")
        if self.spending_limits is not None:
            if (
                sum(
                    [
                        self.spending_limits.day is not None,
                        self.spending_limits.week is not None,
                        self.spending_limits.month is not None,
                        self.spending_limits.quarter is not None,
                        self.spending_limits.year is not None,
                        self.spending_limits.all_time is not None,
                    ]
                )
                > 1
            ):
                raise ValueError(
                    "You can have at most 1 periodic (day/week/month/quarter/all-time) limit at a time."
                )
        return self

ModelSpendingLimits

Bases: BaseModel

All spending limits set for the card.

Source code in pyrevolut/api/cards/post/create_card.py
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
class ModelSpendingLimits(BaseModel):
    """All spending limits set for the card."""

    class ModelSingle(ModelBaseAmount):
        """The limit for a single transaction."""

        pass

    class ModelDay(ModelBaseAmount):
        """The daily limit for transactions."""

        pass

    class ModelWeek(ModelBaseAmount):
        """The weekly limit for transactions."""

        pass

    class ModelMonth(ModelBaseAmount):
        """The monthly limit for transactions."""

        pass

    class ModelQuarter(ModelBaseAmount):
        """The quarterly limit for transactions."""

        pass

    class ModelYear(ModelBaseAmount):
        """The yearly limit for transactions."""

        pass

    class ModelAllTime(ModelBaseAmount):
        """The all-time limit for transactions."""

        pass

    single: Annotated[
        ModelSingle | None,
        Field(description="The limit for a single transaction."),
    ]
    day: Annotated[
        ModelDay | None,
        Field(description="The daily limit for transactions."),
    ]
    week: Annotated[
        ModelWeek | None,
        Field(description="The weekly limit for transactions."),
    ]
    month: Annotated[
        ModelMonth | None,
        Field(description="The monthly limit for transactions."),
    ]
    quarter: Annotated[
        ModelQuarter | None,
        Field(description="The quarterly limit for transactions."),
    ]
    year: Annotated[
        ModelYear | None,
        Field(description="The yearly limit for transactions."),
    ]
    all_time: Annotated[
        ModelAllTime | None,
        Field(description="The all-time limit for transactions."),
    ]
ModelAllTime

Bases: ModelBaseAmount

The all-time limit for transactions.

Source code in pyrevolut/api/cards/post/create_card.py
58
59
60
61
class ModelAllTime(ModelBaseAmount):
    """The all-time limit for transactions."""

    pass
ModelDay

Bases: ModelBaseAmount

The daily limit for transactions.

Source code in pyrevolut/api/cards/post/create_card.py
33
34
35
36
class ModelDay(ModelBaseAmount):
    """The daily limit for transactions."""

    pass
ModelMonth

Bases: ModelBaseAmount

The monthly limit for transactions.

Source code in pyrevolut/api/cards/post/create_card.py
43
44
45
46
class ModelMonth(ModelBaseAmount):
    """The monthly limit for transactions."""

    pass
ModelQuarter

Bases: ModelBaseAmount

The quarterly limit for transactions.

Source code in pyrevolut/api/cards/post/create_card.py
48
49
50
51
class ModelQuarter(ModelBaseAmount):
    """The quarterly limit for transactions."""

    pass
ModelSingle

Bases: ModelBaseAmount

The limit for a single transaction.

Source code in pyrevolut/api/cards/post/create_card.py
28
29
30
31
class ModelSingle(ModelBaseAmount):
    """The limit for a single transaction."""

    pass
ModelWeek

Bases: ModelBaseAmount

The weekly limit for transactions.

Source code in pyrevolut/api/cards/post/create_card.py
38
39
40
41
class ModelWeek(ModelBaseAmount):
    """The weekly limit for transactions."""

    pass
ModelYear

Bases: ModelBaseAmount

The yearly limit for transactions.

Source code in pyrevolut/api/cards/post/create_card.py
53
54
55
56
class ModelYear(ModelBaseAmount):
    """The yearly limit for transactions."""

    pass

check_inputs()

Check the inputs.

Source code in pyrevolut/api/cards/post/create_card.py
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
@model_validator(mode="after")
def check_inputs(self) -> "CreateCard.Body":
    """Check the inputs."""
    if not self.virtual:
        raise ValueError("You can only create virtual cards via the API.")
    if self.spending_limits is not None:
        if (
            sum(
                [
                    self.spending_limits.day is not None,
                    self.spending_limits.week is not None,
                    self.spending_limits.month is not None,
                    self.spending_limits.quarter is not None,
                    self.spending_limits.year is not None,
                    self.spending_limits.all_time is not None,
                ]
            )
            > 1
        ):
            raise ValueError(
                "You can have at most 1 periodic (day/week/month/quarter/all-time) limit at a time."
            )
    return self

Response

Bases: ResourceCard

Response model for the endpoint.

Source code in pyrevolut/api/cards/post/create_card.py
188
189
190
191
192
193
class Response(ResourceCard):
    """
    Response model for the endpoint.
    """

    pass

FreezeCard

Freeze a card to make it temporarily unavailable for spending. You can only freeze a card that is in the state active.

A successful freeze changes the card's state to frozen, and no content is returned in the response.

Source code in pyrevolut/api/cards/post/freeze_card.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class FreezeCard:
    """
    Freeze a card to make it temporarily unavailable for spending.
    You can only freeze a card that is in the state active.

    A successful freeze changes the card's state to frozen,
    and no content is returned in the response.
    """

    ROUTE = "/1.0/cards/{card_id}/freeze"

    class Body(BaseModel):
        """
        Request body for the endpoint.
        """

        pass

    class Response(BaseModel):
        """
        Response model for the endpoint.
        """

        pass

Body

Bases: BaseModel

Request body for the endpoint.

Source code in pyrevolut/api/cards/post/freeze_card.py
15
16
17
18
19
20
class Body(BaseModel):
    """
    Request body for the endpoint.
    """

    pass

Response

Bases: BaseModel

Response model for the endpoint.

Source code in pyrevolut/api/cards/post/freeze_card.py
22
23
24
25
26
27
class Response(BaseModel):
    """
    Response model for the endpoint.
    """

    pass

UnfreezeCard

Unfreeze a card to re-enable spending for that card. You can only unfreeze a card that is in the state frozen.

A successful unfreeze changes the card's state back to active, and no content is returned in the response.

Source code in pyrevolut/api/cards/post/unfreeze_card.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class UnfreezeCard:
    """
    Unfreeze a card to re-enable spending for that card.
    You can only unfreeze a card that is in the state frozen.

    A successful unfreeze changes the card's state back to active,
    and no content is returned in the response.
    """

    ROUTE = "/1.0/cards/{card_id}/unfreeze"

    class Body(BaseModel):
        """
        Request body for the endpoint.
        """

        pass

    class Response(BaseModel):
        """
        Response model for the endpoint.
        """

        pass

Body

Bases: BaseModel

Request body for the endpoint.

Source code in pyrevolut/api/cards/post/unfreeze_card.py
15
16
17
18
19
20
class Body(BaseModel):
    """
    Request body for the endpoint.
    """

    pass

Response

Bases: BaseModel

Response model for the endpoint.

Source code in pyrevolut/api/cards/post/unfreeze_card.py
22
23
24
25
26
27
class Response(BaseModel):
    """
    Response model for the endpoint.
    """

    pass

UpdateCardDetails

Update details of a specific card, based on its ID. Updating a spending limit does not reset the spending counter.

Source code in pyrevolut/api/cards/patch/update_card_details.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
 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
class UpdateCardDetails:
    """
    Update details of a specific card, based on its ID.
    Updating a spending limit does not reset the spending counter.
    """

    ROUTE = "/1.0/cards/{card_id}"

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

        class ModelSpendingLimits(BaseModel):
            """All spending limits set for the card."""

            class ModelSingle(ModelBaseAmount):
                """The limit for a single transaction."""

                pass

            class ModelDay(ModelBaseAmount):
                """The daily limit for transactions."""

                pass

            class ModelWeek(ModelBaseAmount):
                """The weekly limit for transactions."""

                pass

            class ModelMonth(ModelBaseAmount):
                """The monthly limit for transactions."""

                pass

            class ModelQuarter(ModelBaseAmount):
                """The quarterly limit for transactions."""

                pass

            class ModelYear(ModelBaseAmount):
                """The yearly limit for transactions."""

                pass

            class ModelAllTime(ModelBaseAmount):
                """The all-time limit for transactions."""

                pass

            single: Annotated[
                ModelSingle | Literal["null"] | None,
                Field(description="The limit for a single transaction."),
            ]
            day: Annotated[
                ModelDay | Literal["null"] | None,
                Field(description="The daily limit for transactions."),
            ]
            week: Annotated[
                ModelWeek | Literal["null"] | None,
                Field(description="The weekly limit for transactions."),
            ]
            month: Annotated[
                ModelMonth | Literal["null"] | None,
                Field(description="The monthly limit for transactions."),
            ]
            quarter: Annotated[
                ModelQuarter | Literal["null"] | None,
                Field(description="The quarterly limit for transactions."),
            ]
            year: Annotated[
                ModelYear | Literal["null"] | None,
                Field(description="The yearly limit for transactions."),
            ]
            all_time: Annotated[
                ModelAllTime | Literal["null"] | None,
                Field(description="The all-time limit for transactions."),
            ]

        label: Annotated[
            str | None,
            Field(description="The label of the card.", max_length=30),
        ] = None
        categories: Annotated[
            EnumMerchantCategory | Literal["null"] | None,
            Field(
                description="""
                List of merchant categories that will be available for card spending. 
                Use null to erase the value and reset to empty (all categories will be allowed).
                """
            ),
        ] = None
        spending_limits: Annotated[
            ModelSpendingLimits | Literal["null"] | None,
            Field(
                description="""
                All spending limits set for the card.

                You can have at most 1 periodic (day/week/month/quarter/all-time) and 1 non-periodic (single transaction) 
                limit at a time. If you try to specify 2 periodic limits at a time, it will result in an error.

                Spending limit currency must match the default business currency. 
                The default currency was assigned to your business during onboarding.

                Use null as the value for a specific limit to erase that limit. 
                Use null as the value for the spending_limits object to erase all limits.
                """
            ),
        ] = None

        @model_validator(mode="after")
        def check_inputs(self) -> "UpdateCardDetails.Body":
            """Check the inputs."""
            if self.spending_limits is not None and self.spending_limits != "null":
                if (
                    sum(
                        [
                            self.spending_limits.day is not None
                            and self.spending_limits.day != "null",
                            self.spending_limits.week is not None
                            and self.spending_limits.week != "null",
                            self.spending_limits.month is not None
                            and self.spending_limits.month != "null",
                            self.spending_limits.quarter is not None
                            and self.spending_limits.quarter != "null",
                            self.spending_limits.year is not None
                            and self.spending_limits.year != "null",
                            self.spending_limits.all_time is not None
                            and self.spending_limits.all_time != "null",
                        ]
                    )
                    > 1
                ):
                    raise ValueError(
                        "You can have at most 1 periodic (day/week/month/quarter/all-time) limit at a time."
                    )
            return self

    class Response(ResourceCard):
        """
        Response model for the endpoint.
        """

        pass

Body

Bases: BaseModel

The body of the request.

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

    class ModelSpendingLimits(BaseModel):
        """All spending limits set for the card."""

        class ModelSingle(ModelBaseAmount):
            """The limit for a single transaction."""

            pass

        class ModelDay(ModelBaseAmount):
            """The daily limit for transactions."""

            pass

        class ModelWeek(ModelBaseAmount):
            """The weekly limit for transactions."""

            pass

        class ModelMonth(ModelBaseAmount):
            """The monthly limit for transactions."""

            pass

        class ModelQuarter(ModelBaseAmount):
            """The quarterly limit for transactions."""

            pass

        class ModelYear(ModelBaseAmount):
            """The yearly limit for transactions."""

            pass

        class ModelAllTime(ModelBaseAmount):
            """The all-time limit for transactions."""

            pass

        single: Annotated[
            ModelSingle | Literal["null"] | None,
            Field(description="The limit for a single transaction."),
        ]
        day: Annotated[
            ModelDay | Literal["null"] | None,
            Field(description="The daily limit for transactions."),
        ]
        week: Annotated[
            ModelWeek | Literal["null"] | None,
            Field(description="The weekly limit for transactions."),
        ]
        month: Annotated[
            ModelMonth | Literal["null"] | None,
            Field(description="The monthly limit for transactions."),
        ]
        quarter: Annotated[
            ModelQuarter | Literal["null"] | None,
            Field(description="The quarterly limit for transactions."),
        ]
        year: Annotated[
            ModelYear | Literal["null"] | None,
            Field(description="The yearly limit for transactions."),
        ]
        all_time: Annotated[
            ModelAllTime | Literal["null"] | None,
            Field(description="The all-time limit for transactions."),
        ]

    label: Annotated[
        str | None,
        Field(description="The label of the card.", max_length=30),
    ] = None
    categories: Annotated[
        EnumMerchantCategory | Literal["null"] | None,
        Field(
            description="""
            List of merchant categories that will be available for card spending. 
            Use null to erase the value and reset to empty (all categories will be allowed).
            """
        ),
    ] = None
    spending_limits: Annotated[
        ModelSpendingLimits | Literal["null"] | None,
        Field(
            description="""
            All spending limits set for the card.

            You can have at most 1 periodic (day/week/month/quarter/all-time) and 1 non-periodic (single transaction) 
            limit at a time. If you try to specify 2 periodic limits at a time, it will result in an error.

            Spending limit currency must match the default business currency. 
            The default currency was assigned to your business during onboarding.

            Use null as the value for a specific limit to erase that limit. 
            Use null as the value for the spending_limits object to erase all limits.
            """
        ),
    ] = None

    @model_validator(mode="after")
    def check_inputs(self) -> "UpdateCardDetails.Body":
        """Check the inputs."""
        if self.spending_limits is not None and self.spending_limits != "null":
            if (
                sum(
                    [
                        self.spending_limits.day is not None
                        and self.spending_limits.day != "null",
                        self.spending_limits.week is not None
                        and self.spending_limits.week != "null",
                        self.spending_limits.month is not None
                        and self.spending_limits.month != "null",
                        self.spending_limits.quarter is not None
                        and self.spending_limits.quarter != "null",
                        self.spending_limits.year is not None
                        and self.spending_limits.year != "null",
                        self.spending_limits.all_time is not None
                        and self.spending_limits.all_time != "null",
                    ]
                )
                > 1
            ):
                raise ValueError(
                    "You can have at most 1 periodic (day/week/month/quarter/all-time) limit at a time."
                )
        return self

ModelSpendingLimits

Bases: BaseModel

All spending limits set for the card.

Source code in pyrevolut/api/cards/patch/update_card_details.py
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
class ModelSpendingLimits(BaseModel):
    """All spending limits set for the card."""

    class ModelSingle(ModelBaseAmount):
        """The limit for a single transaction."""

        pass

    class ModelDay(ModelBaseAmount):
        """The daily limit for transactions."""

        pass

    class ModelWeek(ModelBaseAmount):
        """The weekly limit for transactions."""

        pass

    class ModelMonth(ModelBaseAmount):
        """The monthly limit for transactions."""

        pass

    class ModelQuarter(ModelBaseAmount):
        """The quarterly limit for transactions."""

        pass

    class ModelYear(ModelBaseAmount):
        """The yearly limit for transactions."""

        pass

    class ModelAllTime(ModelBaseAmount):
        """The all-time limit for transactions."""

        pass

    single: Annotated[
        ModelSingle | Literal["null"] | None,
        Field(description="The limit for a single transaction."),
    ]
    day: Annotated[
        ModelDay | Literal["null"] | None,
        Field(description="The daily limit for transactions."),
    ]
    week: Annotated[
        ModelWeek | Literal["null"] | None,
        Field(description="The weekly limit for transactions."),
    ]
    month: Annotated[
        ModelMonth | Literal["null"] | None,
        Field(description="The monthly limit for transactions."),
    ]
    quarter: Annotated[
        ModelQuarter | Literal["null"] | None,
        Field(description="The quarterly limit for transactions."),
    ]
    year: Annotated[
        ModelYear | Literal["null"] | None,
        Field(description="The yearly limit for transactions."),
    ]
    all_time: Annotated[
        ModelAllTime | Literal["null"] | None,
        Field(description="The all-time limit for transactions."),
    ]
ModelAllTime

Bases: ModelBaseAmount

The all-time limit for transactions.

Source code in pyrevolut/api/cards/patch/update_card_details.py
55
56
57
58
class ModelAllTime(ModelBaseAmount):
    """The all-time limit for transactions."""

    pass
ModelDay

Bases: ModelBaseAmount

The daily limit for transactions.

Source code in pyrevolut/api/cards/patch/update_card_details.py
30
31
32
33
class ModelDay(ModelBaseAmount):
    """The daily limit for transactions."""

    pass
ModelMonth

Bases: ModelBaseAmount

The monthly limit for transactions.

Source code in pyrevolut/api/cards/patch/update_card_details.py
40
41
42
43
class ModelMonth(ModelBaseAmount):
    """The monthly limit for transactions."""

    pass
ModelQuarter

Bases: ModelBaseAmount

The quarterly limit for transactions.

Source code in pyrevolut/api/cards/patch/update_card_details.py
45
46
47
48
class ModelQuarter(ModelBaseAmount):
    """The quarterly limit for transactions."""

    pass
ModelSingle

Bases: ModelBaseAmount

The limit for a single transaction.

Source code in pyrevolut/api/cards/patch/update_card_details.py
25
26
27
28
class ModelSingle(ModelBaseAmount):
    """The limit for a single transaction."""

    pass
ModelWeek

Bases: ModelBaseAmount

The weekly limit for transactions.

Source code in pyrevolut/api/cards/patch/update_card_details.py
35
36
37
38
class ModelWeek(ModelBaseAmount):
    """The weekly limit for transactions."""

    pass
ModelYear

Bases: ModelBaseAmount

The yearly limit for transactions.

Source code in pyrevolut/api/cards/patch/update_card_details.py
50
51
52
53
class ModelYear(ModelBaseAmount):
    """The yearly limit for transactions."""

    pass

check_inputs()

Check the inputs.

Source code in pyrevolut/api/cards/patch/update_card_details.py
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
@model_validator(mode="after")
def check_inputs(self) -> "UpdateCardDetails.Body":
    """Check the inputs."""
    if self.spending_limits is not None and self.spending_limits != "null":
        if (
            sum(
                [
                    self.spending_limits.day is not None
                    and self.spending_limits.day != "null",
                    self.spending_limits.week is not None
                    and self.spending_limits.week != "null",
                    self.spending_limits.month is not None
                    and self.spending_limits.month != "null",
                    self.spending_limits.quarter is not None
                    and self.spending_limits.quarter != "null",
                    self.spending_limits.year is not None
                    and self.spending_limits.year != "null",
                    self.spending_limits.all_time is not None
                    and self.spending_limits.all_time != "null",
                ]
            )
            > 1
        ):
            raise ValueError(
                "You can have at most 1 periodic (day/week/month/quarter/all-time) limit at a time."
            )
    return self

Response

Bases: ResourceCard

Response model for the endpoint.

Source code in pyrevolut/api/cards/patch/update_card_details.py
148
149
150
151
152
153
class Response(ResourceCard):
    """
    Response model for the endpoint.
    """

    pass

TerminateCard

Terminate a specific card, based on its ID.

Once the card is terminated, it will not be returned by the API.

A successful response does not get any content in return.

Source code in pyrevolut/api/cards/delete/terminate_card.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class TerminateCard:
    """
    Terminate a specific card, based on its ID.

    Once the card is terminated, it will not be returned by the API.

    A successful response does not get any content in return.
    """

    ROUTE = "cards/{card_id}"

    class Params(BaseModel):
        """Query parameters for the endpoint."""

        pass

    class Response(BaseModel):
        """Response model for the endpoint."""

        pass

Params

Bases: BaseModel

Query parameters for the endpoint.

Source code in pyrevolut/api/cards/delete/terminate_card.py
15
16
17
18
class Params(BaseModel):
    """Query parameters for the endpoint."""

    pass

Response

Bases: BaseModel

Response model for the endpoint.

Source code in pyrevolut/api/cards/delete/terminate_card.py
20
21
22
23
class Response(BaseModel):
    """Response model for the endpoint."""

    pass