diff --git a/docs/topics/accounts/overview/guide-generate-statement.mdx b/docs/topics/accounts/overview/guide-generate-statement.mdx
index a391dfe5c1..421d96a4b4 100644
--- a/docs/topics/accounts/overview/guide-generate-statement.mdx
+++ b/docs/topics/accounts/overview/guide-generate-statement.mdx
@@ -2,21 +2,22 @@
title: Generate account statement
---
-# Generate account statement
+# Generate an account statement
Generate an account statement for a custom time period **using the API** or on your **Dashboard**.
## API guide {#guide}
1. Call the `generateAccountStatement` mutation.
-1. Add the `accountId`.
-1. Add the `openingDate` and `closingDate` with the following format: `YYYY-MM-DDT00:00:00.000Z` (up to three months).
-1. Set the `language` for your account statement, and choose `PDF` or `CSV` if you'd like.
-1. Add all information you'd like to review about the statement (lines 11-21).
+1. Add the `accountId` (line 4).
+1. Add the `openingDate` and `closingDate` using format `YYYY-MM-DDT00:00:00.000Z` (lines 5-6).
+ - Maximum period: three months.
+1. Set the `language` for your account statement, and provide the file `format` (`PDF` or `CSV`) (lines 7-8).
+1. Add all information you'd like to review about the statement (lines 11-27).
### Mutation {#mutation}
-Open in API Explorer
+Open in API Explorer
```graphql {4-8} showLineNumbers
mutation GenerateAccountStatement {
@@ -26,50 +27,142 @@ mutation GenerateAccountStatement {
openingDate: "2024-04-12T00:00:00.000Z"
closingDate: "2024-06-12T00:00:00.000Z"
language: nl
- statementType: PDF
+ format: PDF
}
) {
closingDate
createdAt
- fees {
+ feeCredits {
+ currency
+ value
+ }
+ feeDebits {
currency
value
}
id
openingDate
period
- status
+ statusInfo {
+ status
+ }
updatedAt
}
}
-
```
### Payload {#payload}
The mutation returns all of the requested information.
-Notice the `period` = `Custom` (line 12), indicating that you generated this account statement, not Swan.
-```json {12} showLineNumbers
+The `period` field shows `Custom` (line 16) for on-demand statements. Swan automatically generates statements with `period` values of `Monthly` or `Custom`.
+
+The `statusInfo.status` shows `Pending` while Swan generates the statement (line 18).
+
+```json {16,18} showLineNumbers
{
"data": {
"generateAccountStatement": {
"closingDate": "2024-06-12T00:00:00.000Z",
"createdAt": "2024-06-20T15:56:50.096Z",
- "fees": {
+ "feeCredits": {
+ "currency": "EUR",
+ "value": "5.50"
+ },
+ "feeDebits": {
"currency": "EUR",
- "value": "0"
+ "value": "12.00"
},
"id": "$ACCOUNT_STATEMENT_ID",
"openingDate": "2024-04-12T00:00:00.000Z",
"period": "Custom",
- "status": "Available",
+ "statusInfo": {
+ "status": "Pending"
+ },
"updatedAt": "2024-06-20T15:56:52.423Z"
}
}
}
```
+### Retrieve generated statement {#retrieve}
+
+After generating the account statement, the `statusInfo` > `status` changes to `Generated`.
+When the status is `Generated`, you can retrieve the download URL.
+
+1. Call the `accountStatement` query.
+1. Add the account statement `id` (line 2).
+1. Add `statusInfo` for all statuses (line 8). The URL to download the statement is provided in `statusInfo` > `GeneratedStatusInfo` > `url` (line 12).
+
+Open in API Explorer
+
+```graphql {2,8,12} showLineNumbers
+query GetAccountStatement {
+ accountStatement(id: "$ACCOUNT_STATEMENT_ID") {
+ closingDate
+ createdAt
+ id
+ openingDate
+ period
+ statusInfo {
+ status
+ ... on GeneratedStatusInfo {
+ status
+ url
+ }
+ ... on PendingStatusInfo {
+ status
+ }
+ ... on FailedStatusInfo {
+ status
+ }
+ ... on VoidedStatusInfo {
+ status
+ url
+ }
+ }
+ updatedAt
+ }
+}
+```
+
+#### Payload {#retrieve-payload}
+
+The `period` field shows `Custom` (line 8) for on-demand statements.
+
+Use the `url` to download the statement (line 12).
+
+1. Copy the `url` from the payload.
+1. Paste the `url` into your preferred browser and press enter.
+1. The document downloads automatically.
+
+```json {8,12} showLineNumbers
+{
+ "data": {
+ "accountStatement": {
+ "closingDate": "2024-06-12T00:00:00.000Z",
+ "createdAt": "2024-06-20T15:56:50.096Z",
+ "id": "$ACCOUNT_STATEMENT_ID",
+ "openingDate": "2024-04-12T00:00:00.000Z",
+ "period": "Custom",
+ "statusInfo": {
+ "__typename": "GeneratedStatusInfo",
+ "status": "Generated",
+ "url": "$DOWNLOAD_URL"
+ },
+ "updatedAt": "2024-06-20T15:56:58.234Z"
+ }
+ }
+}
+```
+
+:::caution Account statement statuses
+- **`Pending`**: The statement is being generated.
+- **`Generated`**: The statement is ready to download. The `url` field contains the download link.
+- **`Failed`**: Statement generation failed. Double-check your account ID and generate a new statement.
+- **`Voided`**: The statement has been voided. A voided statement `url` is still available for reference.
+:::
+
## Dashboard {#dashboard}
You can also generate statements from your Dashboard.
@@ -81,13 +174,13 @@ You can also generate statements from your Dashboard.

-5. Enter the start date and closing date. The time period can cover **up to three months**.
+5. Enter the opening date and closing date. The time period can cover **up to three months**.
1. Choose the format and language.
1. Click **Save**.

Your new statement appears on your list of account statements with the status `Pending`.
-After the status changes to `Available`, you can download your statement.
+After the status changes to `Generated`, you can download your statement.

\ No newline at end of file