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

# Download Statement

> Use the /api/fdx/5/accounts/{accountId}/statements/{statementId} endpoint to download the original statement file for a particular account. Set the Accept header to the content type you want (application/pdf, image/gif, image/jpeg, image/tiff, or image/png) — defaults to application/pdf.

Use the `/api/fdx/5/accounts/{accountId}/statements/{statementId}` endpoint to download the original statement file for a particular account. Get the `statementId` by calling [Get Statements](/api/outbound/endpoints/fdx/get-statements).

To successfully call this endpoint, you must first call the [/Token](/api/outbound/endpoints/authorize/token) endpoint to obtain a valid `access_token` using:

* grant\_type: `authorization_code` or `refresh_token`
* client\_id: `{recipient client_id}`
* client\_secret: `{recipient client_secret}`
* redirect\_uri: `{recipient redirect_uri}`
* code: `{with grant type authorization_code}`
* refresh\_token: `{with grant type refresh_token}`

## Choose the file format

Set the `Accept` header to the content type you want. If you omit it, or send `*/*`, the statement is returned as `application/pdf`. If you send several values, the first supported one is used.

| **ACCEPT HEADER** |
| :- |
| `application/pdf` |
| `image/gif` |
| `image/jpeg` |
| `image/tiff` |
| `image/png` |

If the requested content type isn't supported, the endpoint returns error 1203 (406).

## Handle the response

* **200**: The response body is the statement file in the requested format.
* **302**: The statement is available at another location. Follow the URL in the `Location` header.
* **400 with code 1300**: The statement is still processing. Try again later. Use [Get Statements](/api/outbound/endpoints/fdx/get-statements) to check the statement's `status`.
* **413 with code 413**: The statement file is larger than the maximum size Flinks will return directly.
* **404 with code 1104 or 1108**: The `statementId` doesn't exist for the account, or the account has no statements.

<Note>
  <p class="h4">Not all Data Providers support this endpoint</p>

  If the Data Provider does not support statements, this endpoint returns error 501 (Subsystem unavailable) with a 405 status code.
</Note>

## How to handle an error response

If you receive an error response, refer to the [List of Data Access Errors](/api/outbound/endpoints/fdx/fdx-errors) for more information about the error and how to resolve it.

<ResponseExample>
  ```text 200 - OK theme={null}
  Binary file content (for example, application/pdf)
  ```

  ```http 302 - Found theme={null}
  HTTP/1.1 302 Found
  Location: https://example.com/statements/20001.pdf
  ```

  ```json 4XX - Statement is processing theme={null}
  {
    "code": 1300,
    "message": "Statement is Processing",
    "debugMessage": "Provider custom developer-level error details for troubleshooting"
  }
  ```

  ```json 5XX - Result theme={null}
  {
    "code": 500,
    "message": "Internal Server Error",
    "debugMessage": "An unexpected error occured"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml openapi-outbound.yaml GET /api/fdx/5/accounts/{account_id}/statements/{statement_id}
openapi: 3.0.3
info:
  title: Flinks API
  description: >
    Flinks API provides financial data connectivity, enrichment, and payment
    solutions.


    ## Authentication

    Endpoints require authentication using `flinks-auth-key` header (Bearer
    token).


    For more information, visit: https://docs.flinks.com
  version: 3.0.0
  contact:
    name: Flinks Support
    url: https://www.flinks.com/contact/sales
  termsOfService: https://www.flinks.com
servers:
  - url: https://ob.flinksapp.com
    description: Flinks Outbound Production
security:
  - BearerAuth: []
tags:
  - name: Authorization
    description: Endpoints for generating authorization tokens and authenticating requests
paths:
  /api/fdx/5/accounts/{account_id}/statements/{statement_id}:
    get:
      tags:
        - FDX
      summary: Download Statement
      description: >-
        Use the /api/fdx/5/accounts/{accountId}/statements/{statementId}
        endpoint to download the original statement file for a particular
        account. Set the Accept header to the content type you want
        (application/pdf, image/gif, image/jpeg, image/tiff, or image/png) —
        defaults to application/pdf.
      operationId: fdxDownloadStatement
      parameters:
        - name: account_id
          in: path
          required: true
          description: The ID of the customer account that the statement belongs to.
          schema:
            type: string
        - name: statement_id
          in: path
          required: true
          description: The statementId returned by Get Statements.
          schema:
            type: string
        - name: Accept
          in: header
          required: false
          description: >-
            The content type you want the statement returned as. Defaults to
            application/pdf if omitted.
          schema:
            type: string
            enum:
              - application/pdf
              - image/gif
              - image/jpeg
              - image/tiff
              - image/png
      responses:
        '200':
          description: The statement file.
          content:
            application/pdf:
              schema:
                type: string
                format: binary
            image/gif:
              schema:
                type: string
                format: binary
            image/jpeg:
              schema:
                type: string
                format: binary
            image/tiff:
              schema:
                type: string
                format: binary
            image/png:
              schema:
                type: string
                format: binary
        '302':
          description: >-
            The statement is available at another location. The URL is returned
            in the Location header.
        '413':
          description: >-
            Returned when the statement file is larger than the maximum size
            Flinks returns directly.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    description: Error code.
                  message:
                    type: string
                    description: A description of the error.
                  debugMessage:
                    type: string
                    description: >-
                      Provider custom developer-level error details for
                      troubleshooting.
        4XX:
          description: >-
            Returned when the request contains invalid data, the statement isn't
            ready yet, or authentication fails.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    description: Error code.
                  message:
                    type: string
                    description: A description of the error.
                  debugMessage:
                    type: string
                    description: >-
                      Provider custom developer-level error details for
                      troubleshooting.
        5XX:
          description: Returned when an internal server error occurred.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    description: Error code.
                  message:
                    type: string
                    description: A description of the error.
                  debugMessage:
                    type: string
                    description: >-
                      Provider custom developer-level error details for
                      troubleshooting.
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Bearer token obtained from the /Token endpoint.

````