You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generate an account statement for a custom time period **using the API** or on your **Dashboard**.
8
8
9
9
## API guide {#guide}
10
10
11
11
1. Call the `generateAccountStatement` mutation.
12
-
1. Add the `accountId`.
13
-
1. Add the `openingDate` and `closingDate` with the following format: `YYYY-MM-DDT00:00:00.000Z` (up to three months).
14
-
1. Set the `language` for your account statement, and choose `PDF` or `CSV` if you'd like.
15
-
1. Add all information you'd like to review about the statement (lines 11-21).
12
+
1. Add the `accountId` (line 4).
13
+
1. Add the `openingDate` and `closingDate` using format `YYYY-MM-DDT00:00:00.000Z` (lines 5-6).
14
+
- Maximum period: three months.
15
+
1. Set the `language` for your account statement, and provide the file `format` (`PDF` or `CSV`) (lines 7-8).
16
+
1. Add all information you'd like to review about the statement (lines 11-27).
16
17
17
18
### Mutation {#mutation}
18
19
19
-
<ahref="https://explorer.swan.io?query=bXV0YXRpb24gR2VuZXJhdGVBY2NvdW50U3RhdGVtZW50IHsKICBnZW5lcmF0ZUFjY291bnRTdGF0ZW1lbnQoCiAgICBpbnB1dDogewogICAgICBhY2NvdW50SWQ6ICIkQUNDT1VOVF9JRCIKICAgICAgb3BlbmluZ0RhdGU6ICIyMDI0LTA0LTEyVDAwOjAwOjAwLjAwMFoiCiAgICAgIGNsb3NpbmdEYXRlOiAiMjAyNC0wNi0xMlQwMDowMDowMC4wMDBaIgogICAgICBsYW5ndWFnZTogbmwKICAgICAgc3RhdGVtZW50VHlwZTogUERGCiAgICB9CiAgKSB7CiAgICBjbG9zaW5nRGF0ZQogICAgY3JlYXRlZEF0CiAgICBmZWVzIHsKICAgICAgY3VycmVuY3kKICAgICAgdmFsdWUKICAgIH0KICAgIGlkCiAgICBvcGVuaW5nRGF0ZQogICAgcGVyaW9kCiAgICBzdGF0dXMKICAgIHVwZGF0ZWRBdAogIH0KfQo%3D&tab=api"className="explorer-badge">Open in API Explorer</a>
20
+
<ahref="https://explorer.swan.io?query=bXV0YXRpb24gR2VuZXJhdGVBY2NvdW50U3RhdGVtZW50IHsKICBnZW5lcmF0ZUFjY291bnRTdGF0ZW1lbnQoCiAgICBpbnB1dDogewogICAgICBhY2NvdW50SWQ6ICIkQUNDT1VOVF9JRCIKICAgICAgb3BlbmluZ0RhdGU6ICIyMDI0LTA0LTEyVDAwOjAwOjAwLjAwMFoiCiAgICAgIGNsb3NpbmdEYXRlOiAiMjAyNC0wNi0xMlQwMDowMDowMC4wMDBaIgogICAgICBsYW5ndWFnZTogbmwKICAgICAgZm9ybWF0OiBQREYKICAgIH0KICApIHsKICAgIGNsb3NpbmdEYXRlCiAgICBjcmVhdGVkQXQKICAgIGZlZUNyZWRpdHMgewogICAgICBjdXJyZW5jeQogICAgICB2YWx1ZQogICAgfQogICAgZmVlRGViaXRzIHsKICAgICAgY3VycmVuY3kKICAgICAgdmFsdWUKICAgIH0KICAgIGlkCiAgICBvcGVuaW5nRGF0ZQogICAgcGVyaW9kCiAgICBzdGF0dXNJbmZvIHsKICAgICAgc3RhdHVzCiAgICB9CiAgICB1cGRhdGVkQXQKICB9Cn0K"className="explorer-badge">Open in API Explorer</a>
The mutation returns all of the requested information.
51
-
Notice the `period` = `Custom` (line 12), indicating that you generated this account statement, not Swan.
52
57
53
-
```json {12} showLineNumbers
58
+
The `period` field shows `Custom` (line 16) for on-demand statements. Swan automatically generates statements with `period` values of `Monthly` or `Custom`.
59
+
60
+
The `statusInfo.status` shows `Pending` while Swan generates the statement (line 18).
61
+
62
+
```json {16,18} showLineNumbers
54
63
{
55
64
"data": {
56
65
"generateAccountStatement": {
57
66
"closingDate": "2024-06-12T00:00:00.000Z",
58
67
"createdAt": "2024-06-20T15:56:50.096Z",
59
-
"fees": {
68
+
"feeCredits": {
69
+
"currency": "EUR",
70
+
"value": "5.50"
71
+
},
72
+
"feeDebits": {
60
73
"currency": "EUR",
61
-
"value": "0"
74
+
"value": "12.00"
62
75
},
63
76
"id": "$ACCOUNT_STATEMENT_ID",
64
77
"openingDate": "2024-04-12T00:00:00.000Z",
65
78
"period": "Custom",
66
-
"status": "Available",
79
+
"statusInfo": {
80
+
"status": "Pending"
81
+
},
67
82
"updatedAt": "2024-06-20T15:56:52.423Z"
68
83
}
69
84
}
70
85
}
71
86
```
72
87
88
+
### Retrieve generated statement {#retrieve}
89
+
90
+
After generating the account statement, the `statusInfo` > `status` changes to `Generated`.
91
+
When the status is `Generated`, you can retrieve the download URL.
92
+
93
+
1. Call the `accountStatement` query.
94
+
1. Add the account statement `id` (line 2).
95
+
1. Add `statusInfo` for all statuses (line 8). The URL to download the statement is provided in `statusInfo` > `GeneratedStatusInfo` > `url` (line 12).
96
+
97
+
<ahref="https://explorer.swan.io?query=cXVlcnkgR2V0QWNjb3VudFN0YXRlbWVudCB7CiAgYWNjb3VudFN0YXRlbWVudChpZDogIiRBQ0NPVU5UX1NUQVRFTUVOVF9JRCIpIHsKICAgIGNsb3NpbmdEYXRlCiAgICBjcmVhdGVkQXQKICAgIGlkCiAgICBvcGVuaW5nRGF0ZQogICAgcGVyaW9kCiAgICBzdGF0dXNJbmZvIHsKICAgICAgc3RhdHVzCiAgICAgIC4uLiBvbiBHZW5lcmF0ZWRTdGF0dXNJbmZvIHsKICAgICAgICBzdGF0dXMKICAgICAgICB1cmwKICAgICAgfQogICAgICAuLi4gb24gUGVuZGluZ1N0YXR1c0luZm8gewogICAgICAgIHN0YXR1cwogICAgICB9CiAgICAgIC4uLiBvbiBGYWlsZWRTdGF0dXNJbmZvIHsKICAgICAgICBzdGF0dXMKICAgICAgfQogICAgICAuLi4gb24gVm9pZGVkU3RhdHVzSW5mbyB7CiAgICAgICAgc3RhdHVzCiAgICAgICAgdXJsCiAgICAgIH0KICAgIH0KICAgIHVwZGF0ZWRBdAogIH0KfQo="className="explorer-badge">Open in API Explorer</a>
98
+
99
+
```graphql {2,8,12} showLineNumbers
100
+
queryGetAccountStatement {
101
+
accountStatement(id: "$ACCOUNT_STATEMENT_ID") {
102
+
closingDate
103
+
createdAt
104
+
id
105
+
openingDate
106
+
period
107
+
statusInfo {
108
+
status
109
+
...onGeneratedStatusInfo {
110
+
status
111
+
url
112
+
}
113
+
...onPendingStatusInfo {
114
+
status
115
+
}
116
+
...onFailedStatusInfo {
117
+
status
118
+
}
119
+
...onVoidedStatusInfo {
120
+
status
121
+
url
122
+
}
123
+
}
124
+
updatedAt
125
+
}
126
+
}
127
+
```
128
+
129
+
#### Payload {#retrieve-payload}
130
+
131
+
The `period` field shows `Custom` (line 8) for on-demand statements.
132
+
133
+
Use the `url` to download the statement (line 12).
134
+
135
+
1. Copy the `url` from the payload.
136
+
1. Paste the `url` into your preferred browser and press enter.
137
+
1. The document downloads automatically.
138
+
139
+
```json {8,12} showLineNumbers
140
+
{
141
+
"data": {
142
+
"accountStatement": {
143
+
"closingDate": "2024-06-12T00:00:00.000Z",
144
+
"createdAt": "2024-06-20T15:56:50.096Z",
145
+
"id": "$ACCOUNT_STATEMENT_ID",
146
+
"openingDate": "2024-04-12T00:00:00.000Z",
147
+
"period": "Custom",
148
+
"statusInfo": {
149
+
"__typename": "GeneratedStatusInfo",
150
+
"status": "Generated",
151
+
"url": "$DOWNLOAD_URL"
152
+
},
153
+
"updatedAt": "2024-06-20T15:56:58.234Z"
154
+
}
155
+
}
156
+
}
157
+
```
158
+
159
+
:::caution Account statement statuses
160
+
-**`Pending`**: The statement is being generated.
161
+
-**`Generated`**: The statement is ready to download. The `url` field contains the download link.
162
+
-**`Failed`**: Statement generation failed. Double-check your account ID and generate a new statement.
163
+
-**`Voided`**: The statement has been voided. A voided statement `url` is still available for reference.
164
+
:::
165
+
73
166
## Dashboard {#dashboard}
74
167
75
168
You can also generate statements from your Dashboard.
@@ -81,13 +174,13 @@ You can also generate statements from your Dashboard.
81
174
82
175

83
176
84
-
5. Enter the start date and closing date. The time period can cover **up to three months**.
177
+
5. Enter the opening date and closing date. The time period can cover **up to three months**.
85
178
1. Choose the format and language.
86
179
1. Click **Save**.
87
180
88
181

89
182
90
183
Your new statement appears on your list of account statements with the status `Pending`.
91
-
After the status changes to `Available`, you can download your statement.
184
+
After the status changes to `Generated`, you can download your statement.
92
185
93
186

0 commit comments