> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vultlocal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Account Statement

> Generate PDF or CSV account statement

<Info>
  Generate downloadable account statements in PDF or CSV format for a specified date range.
</Info>

## Request

<ParamField header="Authorization" type="string" required>
  `Bearer olive_live_xxx` or `Bearer eyJ...` (JWT)
</ParamField>

### Body Parameters

<ParamField body="subscriber_id" type="string" required>
  Subscriber UUID
</ParamField>

<ParamField body="pin" type="string" required>
  Subscriber's 4-digit PIN
</ParamField>

<ParamField body="from_date" type="string" required>
  Start date (`YYYY-MM-DD`)
</ParamField>

<ParamField body="to_date" type="string" required>
  End date (`YYYY-MM-DD`)
</ParamField>

<ParamField body="format" type="string" default="pdf">
  Output format: `pdf` or `csv`
</ParamField>

***

## Response

<ResponseField name="success" type="boolean">
  Whether generation succeeded
</ResponseField>

<ResponseField name="statement_url" type="string">
  Download URL (valid for 24 hours)
</ResponseField>

<ResponseField name="transaction_count" type="integer">
  Number of transactions in statement
</ResponseField>

***

## Examples

<RequestExample>
  ```bash cURL - PDF Statement theme={null}
  curl -X POST "https://demo.api.vultlocal.com/api/v1/wallet/account-statement" \
    -H "Authorization: Bearer olive_live_xxx" \
    -H "Content-Type: application/json" \
    -d '{
      "subscriber_id": "sub_abc123",
      "pin": "1234",
      "from_date": "2025-01-01",
      "to_date": "2025-01-31",
      "format": "pdf"
    }'
  ```

  ```bash cURL - CSV Statement theme={null}
  curl -X POST "https://demo.api.vultlocal.com/api/v1/wallet/account-statement" \
    -H "Authorization: Bearer olive_live_xxx" \
    -H "Content-Type: application/json" \
    -d '{
      "subscriber_id": "sub_abc123",
      "pin": "1234",
      "from_date": "2025-01-01",
      "to_date": "2025-01-31",
      "format": "csv"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 Success theme={null}
  {
    "success": true,
    "message": "Statement generated successfully",
    "statement_url": "https://storage.olive.example.com/statements/stmt_abc123.pdf",
    "transaction_count": 45,
    "period": {
      "from": "2025-01-01",
      "to": "2025-01-31"
    },
    "opening_balance": "50,000.00 SLE",
    "closing_balance": "125,000.00 SLE",
    "expires_at": "2025-02-01T10:30:00Z"
  }
  ```

  ```json 400 Invalid Date theme={null}
  {
    "error": "Invalid date range",
    "code": "INVALID_DATE_RANGE",
    "details": "from_date must be before to_date"
  }
  ```
</ResponseExample>

***

## Statement Contents

<Tabs>
  <Tab title="PDF Format">
    Professional statement including:

    * Account holder details
    * Opening/closing balance
    * Transaction table with dates
    * Running balance column
    * Summary totals
  </Tab>

  <Tab title="CSV Format">
    Raw data for import:

    ```csv theme={null}
    Date,Type,Description,Debit,Credit,Balance
    2025-01-15,transfer_p2p,Payment to Jane Smith,50000.00,,125000.00
    2025-01-14,agent_cashin,Cash deposit via Agent ABC,,100000.00,175000.00
    ```
  </Tab>
</Tabs>

***

## Date Range Limits

| Period    | Maximum Range |
| --------- | ------------- |
| Standard  | 90 days       |
| Premium   | 365 days      |
| Corporate | Unlimited     |

<Warning>
  Statement URLs expire after 24 hours. Download or share immediately.
</Warning>

***

## Errors

| Status | Code                   | Description                     |
| ------ | ---------------------- | ------------------------------- |
| 400    | `INVALID_DATE_RANGE`   | Invalid or excessive date range |
| 400    | `INVALID_FORMAT`       | Format must be pdf or csv       |
| 400    | `INVALID_PIN`          | PIN verification failed         |
| 401    | `UNAUTHORIZED`         | Invalid API key                 |
| 404    | `SUBSCRIBER_NOT_FOUND` | Subscriber not found            |
| 500    | `GENERATION_FAILED`    | Statement generation error      |


## OpenAPI

````yaml olive-openapi.json POST /wallet/account-statement
openapi: 3.0.0
info:
  description: >-
    API Gateway for OLIVE NFC Card Payment System - Comprehensive payment, card
    management, agent operations, and admin authentication. All /api/v1 routes
    require authentication using either API Key or JWT token.
  title: OLIVE NFC Card Payment API
  termsOfService: http://swagger.io/terms/
  contact:
    name: API Support
    email: support@olive.sl
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.0
servers:
  - url: https://olive-gateway-a6ba.onrender.com/api/v1
security: []
paths:
  /wallet/account-statement:
    post:
      tags:
        - Wallet
      summary: Request account statement (PDF only)
      description: >-
        Get comprehensive financial statement for a subscriber with all
        transactions within date range. Returns data for PDF generation and
        WhatsApp delivery.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/handler.GetAccountStatementRequest'
        description: Account statement request
        required: true
      responses:
        '200':
          description: Statement data for PDF generation
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
        - BearerAuth: []
components:
  schemas:
    handler.GetAccountStatementRequest:
      type: object
      required:
        - end_date
        - start_date
        - subscriber_id
      properties:
        end_date:
          type: string
          example: '2025-11-08'
        start_date:
          type: string
          example: '2025-10-01'
        subscriber_id:
          type: string
          example: subscriber-uuid
  securitySchemes:
    ApiKeyAuth:
      description: >-
        API Key for third-party integrations (WhatsApp, Smart PAY, VULT).
        Format: 'Bearer olive_live_xxxxxxxxxxxxx'
      type: apiKey
      name: Authorization
      in: header
    BearerAuth:
      description: >-
        JWT token from admin login for administrative operations. Format:
        'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
      type: apiKey
      name: Authorization
      in: header

````