Skip to content

Bank Transaction

Bank transactions represent financial movements in your bank accounts, typically imported from bank statement files (CAMT.053, etc.). They can be reconciled with invoices, expenses, journal transactions, and other business records for comprehensive financial tracking.

Allowed query parameters

Filters

FilterTypeDescription
searchStringFull-text search across transaction details
bank_accountIdFilter by Bank Account Id
date_rangeDateRangeFilter by booking date
<start-date>,<end-date>
amount_rangeRangeFilter by transaction amount range
reconciledBooleanFilter by reconciliation status
is_processingBooleanShow only transactions currently being processed

Sorting

booking_date, value_date, document_date, amount, name, created_at

Includes

bankAccount, matches.matchable

Upload and import bank transactions

post
/bank_account/{bankAccountId}/import-transactions

This endpoint allows you to upload and import bank transactions from various file formats. The system supports multiple import methods with automatic data processing and matching capabilities.

Supported file formats

FormatExtensionsDescription
CAMT XML.xmlStandard bank statement format (CAMT.053) with complete transaction details
CSV/Excel.csv, .txt, .xls, .xlsxTabular data with AI-powered column mapping

Request parameters

Attribute (* required)TypeDescription
files.* *FileArray of files to import (max 5MB each)

Example request

http
POST /bank_account/AG52olvLXP/import-transactions
Content-Type: multipart/form-data
files[0]=bank_statement.xml
files[1]=transactions.csv

Example response

json
// HTTP 200 OK
[
    {
        "id": "9c3b5e4d-8f2a-4b6c-9d1e-2f3a4b5c6d7e",
        "name": "bank_statement.xml",
        "totalJobs": 25,
        "pendingJobs": 25,
        "processedJobs": 0,
        "progress": 0,
        "finished": false,
        "cancelled": false,
        "created_at": "2024-01-15T10:30:00.000000Z"
    },
    {
        "id": "8b2a4c3d-7e1f-5a8b-8c2d-1e4f5a8b9c2d",
        "name": "transactions.csv",
        "totalJobs": 150,
        "pendingJobs": 150,
        "processedJobs": 0,
        "progress": 0,
        "finished": false,
        "cancelled": false,
        "created_at": "2024-01-15T10:30:00.000000Z"
    }
]

Error handling

Common error scenarios:

  • 422 Unprocessable Entity: Could not match CSV columns automatically
  • 413 Payload Too Large: File exceeds 5MB limit
  • 415 Unsupported Media Type: Invalid file format
  • 403 Forbidden: Insufficient permissions (requires create bank_transaction or supervise invoices permission)

Monitoring import progress

The import process runs asynchronously in the background. Use the returned batch IDs to monitor processing status and provide real-time feedback to users.

For detailed information on monitoring batch progress, polling recommendations, and handling batch status updates, see the Background Jobs guide.

Create a bank transaction

post
/bank_transaction

Create a bank transaction manually. The transaction will be automatically processed for AI optimization (if name is missing but text is provided) or matching against existing records.

Attribute (* required)TypeDescription
bank_account_id *StringBank Account Id
acc_serv_ref *StringUnique identifier for this transaction
amount *NumericTransaction amount (positive for credits, negative for debits)
entry_acc_serv_refString?Entry account servicer reference
document_dateDate?Document date from the transaction
booking_dateDate?Booking date when transaction was processed
value_dateDate?Value date when funds become available
currencyString?Currency code (max 3 characters, defaults to bank account currency)
referenceString?Payment reference or structured reference
nameString?Transaction counterparty name
textString?Additional transaction description
end_to_end_idString?End-to-end identification

Example response

json
// HTTP 201 Created
{
    "id": "v7rnRjBn9o",
    "bank_account_id": "AG52olvLXP",
    "bank_account": null,
    "matches": [],
    "acc_serv_ref": "202401150001",
    "entry_acc_serv_ref": "202401150001-1",
    "end_to_end_id": "NOTPROVIDED",
    "document_date": "2024-01-15",
    "booking_date": "2024-01-15",
    "value_date": "2024-01-15",
    "amount": -125.5,
    "currency": "CHF",
    "reference": "RF18 5390 0754 7034 2",
    "name": "ACME Corporation AG",
    "text": "Invoice payment 2024-001",
    "is_processing": true,
    "is_reconciled": false
}

Important notes

  • Processing: New transactions are automatically set to is_processing: true and will be processed asynchronously
  • AI Optimization: If name is not provided but text is provided, the transaction will be optimized using AI to extract better details
  • Auto-matching: After creation (or AI optimization), the system automatically attempts to match the transaction with existing records (invoices, expenses, etc.)
  • Uniqueness: The acc_serv_ref must be unique across all bank transactions

Retrieve a bank transaction

get
/bank_transaction/{id}

Example response

json
// HTTP 200 OK
{
    "id": "v7rnRjBn9o",
    "bank_account_id": "AG52olvLXP",
    "acc_serv_ref": "202401150001",
    "entry_acc_serv_ref": "202401150001-1",
    "end_to_end_id": "NOTPROVIDED",
    "document_date": "2024-01-15",
    "booking_date": "2024-01-15",
    "value_date": "2024-01-15",
    "amount": -125.5,
    "currency": "CHF",
    "reference": "RF18 5390 0754 7034 2",
    "name": "ACME Corporation AG",
    "text": "Invoice payment 2024-001",
    "is_processing": false,
    "is_reconciled": false,
    "bank_account": {
        "id": "AG52olvLXP",
        "name": "Business Account CHF",
        "iban": "CH93 0076 2011 6238 5295 7",
        "currency": "CHF"
    },
    "matches": []
}

Delete a bank transaction

delete
/bank_transaction/{id}

Deleting a bank transaction will also remove all associated matches and reconciliations.

Example response

json
// HTTP 204 No Content

List bank transactions

get
/bank_transaction

Returns a paginated list of bank transactions. The list endpoint accepts the same query parameters as described above and returns an array of bank transaction objects in the data property.

Read more about Pagination, Filtering, Sorting and Includes on the Introduction page.

Example response

json
// HTTP 200 OK
{
    "data": [
        {
            "id": "v7rnRjBn9o",
            "bank_account_id": "AG52olvLXP",
            "acc_serv_ref": "202401150001",
            "entry_acc_serv_ref": "202401150001-1",
            "end_to_end_id": "NOTPROVIDED",
            "document_date": "2024-01-15",
            "booking_date": "2024-01-15",
            "value_date": "2024-01-15",
            "amount": -125.5,
            "currency": "CHF",
            "reference": "RF18 5390 0754 7034 2",
            "name": "ACME Corporation AG",
            "text": "Invoice payment 2024-001",
            "is_processing": false,
            "is_reconciled": false,
            "bank_account": null,
            "matches": []
        }
        // ... more transactions
    ],
    "links": {
        "first": "https://api.strawblond.com/bank_transaction?page=1",
        "last": "https://api.strawblond.com/bank_transaction?page=10",
        "prev": null,
        "next": "https://api.strawblond.com/bank_transaction?page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 10,
        "path": "https://api.strawblond.com/bank_transaction",
        "per_page": 50,
        "to": 50,
        "total": 487
    }
}