---
updatedAt: 2025-02-20T00:12:44.000Z
agentTools:
  projectIndex: https://developers.credrails.com/llms.txt
---

# Fetch Transactions

The transactions request enables us to get all transactions from a specific bank account.

***Scenario***\
You have consent from user A to access her Bank A account.You will therefore receive transactions of the specified period of that bank account.

***Prerequisites***

1. You have acquired the necessary consent from the user
2. You have the TPA access token for this.
3. JWT token

```json
{
  "requestId": "string",
  "tpaAccessToken": "string",
  "dateFrom": "2022-04-04",
  "dateTo": "2022-04-04",
  "callbackUrl": "https://your-callback-url"
 }
```

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Credrails OpenBanking API",
    "description": "APIs that allows customers to share their financial data with authorized third parties, such as other banks and fintech companies, to access new financial services and products.",
    "license": {
      "name": "Credrails Website",
      "url": "http://www.credrails.com"
    },
    "version": "v2,3,0"
  },
  "externalDocs": {
    "description": "API Documentation",
    "url": "https://credrails.readme.io/docs/open-banking"
  },
  "servers": [
    {
      "url": "https://dev-openbanking.pub.credrails.com",
      "description": "Dev Testing Environment"
    }
  ],
  "tags": [
    {
      "name": "Transactions",
      "description": "The process of collecting and retrieving account statements in order to have a complete understanding of your financial journey,"
    }
  ],
  "paths": {
    "/api/v2/transactions": {
      "post": {
        "tags": [
          "Transactions"
        ],
        "summary": "Fetch Transactions",
        "operationId": "getTransactions",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransactionRequestDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialTransactionDto"
                }
              }
            }
          },
          "201": {
            "description": "Returns an acknowledgement of received transaction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleRequestResponse"
                }
              }
            }
          },
          "202": {
            "description": "The request has not been completely processed. More information is required like OTP",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleRequestResponse"
                }
              }
            }
          },
          "400": {
            "description": "The server is unable to process the request because it perceives it as a client error, such as a syntax mistake in the request, an invalid structure of the request message, or an improper routing of the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleRequestResponse"
                }
              }
            }
          },
          "401": {
            "description": "Whoops, it looks like we're running into some trouble with your request. The server understands your request but it can't complete it because the request lacks valid authentication credentials for the target resource.",
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Oops, it looks like the server is having trouble finding the resource you requested",
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "SimpleRequestResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Code representing request status",
            "enum": [
              "SUCCESS",
              "SECURITY_ANSWER_REQUESTED",
              "INVALID_USERNAME_OR_PASSWORD",
              "INVALID_INSTITUTION_PROVIDED",
              "INVALID_SECURITY_QUESTION_FOR_SESSION",
              "AUTH_NOT_PERFORMED_OR_TIMEDOUT",
              "INVALID_SESSION_ID",
              "UNKNOWN_ERROR",
              "OTP_REQUIRED",
              "INVALID_PAYMENT_TYPE_PROVIDED",
              "DUPLICATE_SESSION_ID",
              "UNSUPPORTED_FEATURE",
              "MISSING_KEY_VALUES",
              "FAILURE",
              "ERROR_RETRIEVING_BALANCE",
              "ERROR_LOGIN_IN",
              "INVALID_SECURITY_ANSWER",
              "INVALID_OTP",
              "ERROR_FETCHING_STATEMENTS",
              "BROWSER_CLOSED",
              "ERROR_RETRIEVING_CREDENTIALS",
              "ERROR_STARTING_BROWSER_SESSION",
              "INSTITUTION_NOT_REACHABLE",
              "BANK_NOT_FOUND",
              "ACCOUNT_PROVIDED_NOT_FOUND",
              "ERROR_MAKING_PAYMENT",
              "INSUFFICIENT_BALANCE",
              "INVALID_AMOUNT",
              "EMPTY_STATEMENT",
              "SESSION_INITIATION_ERROR",
              "OTP_OR_SECURITY_ANSWER_NOT_PROVIDED",
              "INCOMPLETE_OTP",
              "INVALID_CREDENTIALS",
              "ERROR",
              "NO_DATA",
              "RECEIVED",
              "CONSENT_ERROR",
              "USER_DISABLED",
              "REQUEST_CHANGE_PASSWORD",
              "ACCOUNT_BLOCKED",
              "CONFIG_EXISTS",
              "CONFIG_NOT_FOUND",
              "USERNAME_EXISTS",
              "INVALID_REFRESH_TOKEN",
              "LOGOUT_FAILURE",
              "BALANCE_CHECK_REQUEST_EXISTS",
              "PAYMENT_REQUEST_EXISTS",
              "CONSENT_NOT_OBTAINED",
              "INVALID_CONSENT",
              "INVALID_CONSENT_CREDENTIALS",
              "CONSENT_BEING_VALIDATED",
              "VALIDATION_FAILED",
              "PAYMENT_FAILED",
              "BALANCE_CHECK_FAILED",
              "BALANCE_CHECK_REQUEST_NOT_FOUND",
              "TRANSACTIONS_REQUEST_NOT_FOUND",
              "PAYMENT_REQUEST_NOT_FOUND",
              "INVALID_DATES",
              "CHARGES_NOT_SET",
              "INVALID_REQUEST_ID",
              "INVALID_FREQUENCY",
              "STATEMENT_FETCH_FAILED",
              "TRANSACTIONS_CALLBACK_FAILURE",
              "INVALID_USER",
              "TRANSACTIONS_QUEUING_FAILURE",
              "CHARGES_CREATION_FAILURE",
              "CHARGES_UPDATE_FAILURE",
              "GET_CHARGES_FAILURE",
              "PASSWORD_DECRYPTION_FAILED",
              "UNSUPPORTED_BANK_FOR_TRANSACTIONS",
              "INTEGRATION_TYPE_NOT_SUPPORTED",
              "SERVICE_UNAVAILABLE",
              "ERROR_RESETTING_PASSWORD",
              "SCOPE_NOT_SUPPORTED"
            ]
          },
          "message": {
            "type": "string",
            "description": "A message related with the response"
          },
          "requestId": {
            "type": "string",
            "description": "A uuid representing the request from the user"
          }
        }
      },
      "TransactionRequestDto": {
        "required": [
          "callbackUrl",
          "dateFrom",
          "dateTo",
          "requestId",
          "tpaAccessToken"
        ],
        "type": "object",
        "properties": {
          "requestId": {
            "maxLength": 64,
            "minLength": 6,
            "pattern": "[\\w_/.-]+",
            "type": "string",
            "description": "A uuid representing the request from the user"
          },
          "tpaAccessToken": {
            "type": "string",
            "description": "Token specific to the customer consent"
          },
          "dateFrom": {
            "type": "string",
            "description": "Get account transaction to this date, dateformat is yyyy-MM-dd",
            "format": "date"
          },
          "dateTo": {
            "type": "string",
            "description": "Get account transaction to this date, dateformat is yyyy-MM-dd",
            "format": "date"
          },
          "otp": {
            "type": "string"
          },
          "secretQuestionAnswer": {
            "type": "string"
          },
          "callbackUrl": {
            "maxLength": 50,
            "minLength": 8,
            "type": "string",
            "description": "A callback that can request post requests with request_id and response payload",
            "format": "uri",
            "example": "http://example.com/callbackrequests"
          },
          "callbackEmail": {
            "type": "string"
          }
        }
      },
      "FinancialTransactionDto": {
        "required": [
          "accountIdentifier",
          "country",
          "currency",
          "dateFrom",
          "dateGenerated",
          "dateTo",
          "financialProvider",
          "language",
          "requestId",
          "transactions",
          "version"
        ],
        "type": "object",
        "properties": {
          "version": {
            "type": "integer",
            "description": "The transaction payload schema version",
            "format": "int32"
          },
          "requestId": {
            "maxLength": 64,
            "minLength": 6,
            "pattern": "[\\w_/.-]+",
            "type": "string",
            "description": "A uuid representing the request from the user"
          },
          "language": {
            "type": "string",
            "description": "ISO 639-1 - A two letter (Alpha-2) representation of a language"
          },
          "dateGenerated": {
            "type": "string",
            "description": "ISO 8601 date representation on when the transaction statement was generated.",
            "format": "date-time"
          },
          "financialProvider": {
            "type": "string",
            "description": "Provider of the financial services (DTIs). We identify the providers by their swift codes if it exists or we codify their name e.g M-Pesa will be MPESA"
          },
          "accountIdentifier": {
            "type": "string",
            "description": "This could be an account identifier (account number for banks) or  (international phone number for mobile money) in the case of a mobile money"
          },
          "country": {
            "type": "string",
            "description": "ISO 3166 codes for a country where the account is domiciled."
          },
          "dateFrom": {
            "type": "string",
            "description": "ISO 8601 date representation on when the transaction retrieval starts at.",
            "format": "date-time"
          },
          "dateTo": {
            "type": "string",
            "description": "ISO 8601 date representation on when the transaction retrieval ends at.",
            "format": "date-time"
          },
          "currency": {
            "type": "string",
            "description": "ISO representation of currency"
          },
          "transactions": {
            "type": "array",
            "description": "List of trasnactions",
            "items": {
              "$ref": "#/components/schemas/TransactionDto"
            }
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "object"
            }
          },
          "responseCode": {
            "type": "string",
            "description": "Response code as received from statement acquisition"
          },
          "description": {
            "type": "string",
            "description": "Description response message from statement acquisition"
          }
        }
      },
      "TransactionDto": {
        "required": [
          "currency",
          "description",
          "transactionDate",
          "valueDate"
        ],
        "type": "object",
        "properties": {
          "transactionDate": {
            "type": "string",
            "description": "ISO 8601 date representation on when the transaction was executed.",
            "format": "date-time"
          },
          "valueDate": {
            "type": "string",
            "description": "ISO 8601 date representation on when the transaction was fulfilled.",
            "format": "date-time"
          },
          "description": {
            "type": "string",
            "description": "remarks or references to the transaction."
          },
          "currency": {
            "type": "string",
            "description": "ISO representation of currency used in case where the transactions are multi-currency"
          },
          "debit": {
            "type": "number",
            "description": "Debit amount",
            "format": "float"
          },
          "credit": {
            "type": "number",
            "description": "Credit amount",
            "format": "float"
          },
          "transactionTrackingId": {
            "type": "string",
            "description": "transaction TrackingId"
          },
          "labelling": {
            "$ref": "#/components/schemas/TransactionLabelling"
          }
        },
        "description": "List of trasnactions"
      },
      "TransactionLabelling": {
        "required": [
          "category",
          "channel",
          "name",
          "provider",
          "serviceType",
          "subCategory",
          "subscription"
        ],
        "type": "object",
        "properties": {
          "category": {
            "type": "string"
          },
          "channel": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "serviceType": {
            "type": "string"
          },
          "subCategory": {
            "type": "string"
          },
          "subscription": {
            "type": "boolean"
          }
        },
        "description": "transaction categorization"
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```