Retreiving Financial Accounts, Transactions and Balances

How to retrieve financial data from connected accounts?

Once a consent is valid you can start fetching account data, including accounts, balances, and transactions from cash, cards, loans, savings, and securities accounts.

1. Request an API bearer token

Create a JWT with srv: "ais/tpp" and send it to /token.

{
  "sub": "user-123",
  "iss": "tpp/{TPP_ID}",
  "srv": "ais/tpp",
  "iat": 1728986260,
  "exp": 1728986860,
  "ttl": 600
}
curl --location --request POST 'https://{ENVIRONMENT}.feezback.cloud/token' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "token": "{GENERATED_JWT_TOKEN}"
  }'
EnvironmentToken endpoint
Integrationhttps://lgs-integ01.feezback.cloud/token
Productionhttps://lgs-prod.feezback.cloud/token

The returned bearer token is valid for 600 seconds.

2. Retrieve financial data

Use the bearer token to call Feezback's Aggregate Data API.

The userId path parameter is always:

{sub}@{tpp_id}

Use the correct TPP API host:

EnvironmentTPP API host
Integrationhttps://integ01-tpp.feezback.cloud
Productionhttps://prod-tpp.feezback.cloud

Send the bearer token in the Authorization header on each request:

curl --location 'https://{TPP_API_HOST}/tpp/v1/users/USERID/accounts' \
  --header 'Authorization: Bearer {ACCESS_TOKEN}' \
  --header 'X-Tpp-Id: {TPP_ID}'

Before fetching data, confirm the consent is valid — see consent status updates.

Recommended data retrieval flow

  1. Confirm the user has a valid consent.
  2. Call each account type endpoint (accounts, cards, loans, savings, or securities) to get the list of accounts (resourceId) available for the requested userId:
    1. /tpp/v1/users/USERID/accounts
    2. /tpp/v1/users/USERID/cards
    3. /tpp/v1/users/USERID/savings
    4. /tpp/v1/users/USERID/loans
    5. /tpp/v1/users/USERID/securities
  3. In response you will get a list of accounts (resourceId) and the consentId related to each account.
  4. Use each returned resourceId /consentId in the path parameter for detail, balance, and transaction calls.
    1. Fetch balances when the consent includes BALANCES.
    2. Fetch transactions when the consent includes TRANSACTIONS.

Account data endpoints

Method
Endpoint
Purpose
GET
/tpp/v1/users/USERID/accounts
Read the user's account list. Use withBalances to include balances when available.
GET
/tpp/v1/users/USERID/consents/{consentId}/accounts
Read the account list for a specific consent.
GET
/tpp/v1/users/USERID/consents/{consentId}/accounts/{accountId}
Read details for a specific account.
GET
/tpp/v1/users/USERID/consents/{consentId}/accounts/{accountId}/balances
Read balances for a specific account.
GET
/tpp/v2/users/USERID/consents/{consentId}/accounts/{accountId}/transactions
Read transactions for a specific account.
GET
/tpp/v2/export-csv/users/USERID/consents/{consentId}/accounts/{accountId}/transactions
Export account transactions as CSV.

Card data endpoints

Method
Endpoint
Purpose
GET
/tpp/v1/users/USERID/cards
Read the user's card list.
GET
/tpp/v1/users/USERID/consents/{consentId}/cards
Read the card list for a specific consent.
GET
/tpp/v1/users/USERID/consents/{consentId}/cards/{cardId}
Read details for a specific card.
GET
/tpp/v1/users/USERID/consents/{consentId}/cards/{cardId}/balances
Read balances for a specific card.
GET
/tpp/v2/users/USERID/consents/{consentId}/cards/{cardId}/transactions
Read transactions for a specific card.

Savings, loans, and securities endpoints

Account type
List endpoint
Detail endpoint
Balances
Transactions
Additional endpoints
Savings
/tpp/v1/users/USERID/savings and /tpp/v1/users/USERID/consents/{consentId}/savings
/tpp/v1/users/USERID/consents/{consentId}/savings/{savingId}
/tpp/v1/users/USERID/consents/{consentId}/savings/{savingId}/balances
/tpp/v2/users/USERID/consents/{consentId}/savings/{savingId}/transactions
—
Loans
/tpp/v1/users/USERID/loans and /tpp/v1/users/USERID/consents/{consentId}/loans
/tpp/v1/users/USERID/consents/{consentId}/loans/{loanId}
/tpp/v1/users/USERID/consents/{consentId}/loans/{loanId}/balances
/tpp/v2/users/USERID/consents/{consentId}/loans/{loanId}/transactions
—
Securities
/tpp/v1/users/USERID/securities and /tpp/v1/users/USERID/consents/{consentId}/securities
/tpp/v1/users/USERID/consents/{consentId}/securities/{securityId}
—
/tpp/v2/users/USERID/consents/{consentId}/securities/{securityId}/transactions
/orders, /positions

V2 transaction endpoints

Make sure to use V2 endpoints for transactions as V1 is no longer supported.

ResourceEndpoint
Accounts/tpp/v2/users/USERID/consents/{consentId}/accounts/{accountId}/transactions
Cards/tpp/v2/users/USERID/consents/{consentId}/cards/{cardId}/transactions
Savings/tpp/v2/users/USERID/consents/{consentId}/savings/{savingId}/transactions
Loans/tpp/v2/users/USERID/consents/{consentId}/loans/{loanId}/transactions
Securities/tpp/v2/users/USERID/consents/{consentId}/securities/{securityId}/transactions
CSV export/tpp/v2/export-csv/users/USERID/consents/{consentId}/accounts/{accountId}/transactions

V2 pagination:

VersionpagepageSize
v20-based, default 0Default 100, up to 1000

Data deletion endpoint

Use the data deletion tasks endpoint to retrieve information about data scheduled for deletion.

GET /tpp/v1/data-deletion-tasks

Filter by deletionReason (expirationDeletion | consentDeletion), userId, page, pageSize, and taskStatus (RECEIVED | FAILED) when needed.

Common headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token returned from /token.
X-Tpp-IdstringNoTPP identifier.
X-SrvstringNoService routing header.
X-Trace-IdstringNoRequest trace identifier.
X-Request-WaitintegerNoMaximum number of milliseconds the API waits for external ASPSP responses before returning a 307.
X-Psu-IP-AddressstringNoEnd-user IP address when the user is online.
OriginstringNoRequest origin.

Common query parameters

ParameterTypeDefaultDescription
preventUpdateboolean—Prevents financial data refresh. When present, Feezback does not make account data requests to the ASPSP.
withInvalidboolean—Includes invalid consents or resources when supported. Without it, consent list calls include only valid consents.
withBalancesboolean—Includes balances in account, card, loan, saving, or securities list responses when supported and covered by consent.
dateFromstring—Start date for balances or transaction queries. Format: YYYY-MM-DD.
dateTostringCurrent dateEnd date for balances or transaction queries. Format: YYYY-MM-DD.
bookingStatusstring—Required for transaction endpoints. Use booked, pending, or both.
transactionIdstring—Continues a request after a 307 polling response. Use the transaction ID from the Location header.
pageintegerv1: 1; v2: 0Page number for paginated endpoints. v2 transaction endpoints are zero-based.
pageSizeintegerv1: 10; v2: 100Page size — varies by endpoint version. v2 transaction endpoints support 1 to 1000.

Response codes

CodeMeaningAction
200Success.Process the response.
204No content.Treat the delete operation as successful.

Postman Collection

{
  "info": {
    "_postman_id": "2b3340fc-762d-4fec-82e2-fe3c4d0df368",
    "name": "Feezback AIS - Bank Transactions (Integration)",
    "description": "Feezback | Open Banking AIS - זרימה מלאה לשליפת חשבונות, יתרות ותנועות לצורך התאמות בנקים.\n\nהכנה:\n1. לייבא גם את קובץ ה-Environment ולבחור אותו.\n2. למלא tppId, sub, privateKey (PEM, RS512).\n3. הבקשות נשלחות מ-IP שהולבן בפורטל.\n\nסדר הרצה: 1 (אופציונלי, יצירת הסכמה) > 2 > 3 > 4 > 5 > 6 (> 7 אם התקבל 307).\n\nדוקומנטציה: https://docs.feezback.cloud/docs/open-banking-data\nwww.feezback.com",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{accessToken}}",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "1. Consent Link (ais/user) - אופציונלי",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "// ---- חתימת JWT (RS512) עבור srv: ais/user ----",
              "// אם הדבקתם JWT חתום ידנית במשתנה manualJwt - הוא ישמש במקום החתימה האוטומטית.",
              "const manual = pm.variables.get('manualJwt');",
              "if (manual && manual.trim()) {",
              "    pm.variables.set('signedJwt', manual.trim());",
              "    console.log('Using manualJwt');",
              "    return;",
              "}",
              "",
              "const now = Math.floor(Date.now() / 1000);",
              "const payload = {",
              "    sub: pm.variables.get('sub'),",
              "    iss: 'tpp/' + pm.variables.get('tppId'),",
              "    srv: 'ais/user',",
              "    encrypt: true,",
              "    iat: now,",
              "    exp: now + 600,",
              "    ttl: 600,",
              "    flow: {",
              "        id: pm.variables.get('flowId') || 'default',",
              "        dataBaskets: ['ACCOUNTS', 'BALANCES', 'TRANSACTIONS'],",
              "        accountTypes: ['CACC'],",
              "        timePeriods: ['THREE_MONTHS', 'SIX_MONTHS', 'TWELVE_MONTHS'],",
              "        defaultTimePeriod: 'TWELVE_MONTHS',",
              "        context: 'postman-' + now,",
              "        route: 'onboarding',",
              "        userWasAuthenticated: true,",
              "        redirects: {",
              "            success: pm.variables.get('redirectSuccess'),",
              "            failure: pm.variables.get('redirectFailure'),",
              "            ttlExpired: pm.variables.get('redirectExpired')",
              "        }",
              "    }",
              "};",
              "",
              "function signAndStore() {",
              "    var navigator = {}; var window = {};",
              "    eval(pm.collectionVariables.get('jsrsasign_lib'));",
              "    let key = pm.variables.get('privateKey');",
              "    if (key === undefined || key === null || String(key).trim() === '') {",
              "        throw new Error('privateKey ריק - ודאו שה-Environment הנכון נבחר למעלה מימין ושהמפתח הודבק ב-Current value');",
              "    }",
              "    key = String(key).replace(/\\\\n/g, '\\n').replace(/\\r/g, '').trim();",
              "    if (key.includes('PASTE_YOUR_KEY')) {",
              "        throw new Error('privateKey עדיין מכיל את טקסט הדוגמה - הדביקו את המפתח האמיתי ב-Current value');",
              "    }",
              "    const header = { alg: 'RS512', typ: 'JWT' };",
              "    let candidates = [];",
              "    if (key.includes('PRIVATE KEY')) {",
              "        candidates.push(key);",
              "    } else {",
              "        // מפתח בלי שורות BEGIN/END: מנסים לעטוף אוטומטית",
              "        const b64 = key.replace(/\\s+/g, '');",
              "        const body = b64.match(/.{1,64}/g).join('\\n');",
              "        candidates.push('-----BEGIN PRIVATE KEY-----\\n' + body + '\\n-----END PRIVATE KEY-----');",
              "        candidates.push('-----BEGIN RSA PRIVATE KEY-----\\n' + body + '\\n-----END RSA PRIVATE KEY-----');",
              "    }",
              "    let jwt = null, lastErr = null;",
              "    for (const k of candidates) {",
              "        try { jwt = KJUR.jws.JWS.sign('RS512', JSON.stringify(header), JSON.stringify(payload), k); break; }",
              "        catch (e) { lastErr = e; }",
              "    }",
              "    if (!jwt) {",
              "        throw new Error('לא הצלחנו לקרוא את privateKey כמפתח RSA פרטי (PEM). התחלת הערך: ' + key.slice(0, 30) + '... | ' + lastErr);",
              "    }",
              "    pm.variables.set('signedJwt', jwt);",
              "    console.log('JWT payload (ais/user):', JSON.stringify(payload));",
              "}",
              "",
              "if (pm.collectionVariables.get('jsrsasign_lib')) {",
              "    signAndStore();",
              "} else {",
              "    pm.sendRequest('https://cdnjs.cloudflare.com/ajax/libs/jsrsasign/11.1.0/jsrsasign-all-min.js', (err, res) => {",
              "        if (err) { throw err; }",
              "        pm.collectionVariables.set('jsrsasign_lib', res.text());",
              "        signAndStore();",
              "    });",
              "}",
              ""
            ]
          }
        },
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test('Status 200', () => pm.response.to.have.status(200));",
              "const body = pm.response.json();",
              "if (body.link) {",
              "    pm.collectionVariables.set('consentLink', body.link);",
              "    console.log('פתחו את הלינק בדפדפן ואשרו עם MockBank (PSU ID 999076599):', body.link);",
              "}"
            ]
          }
        }
      ],
      "request": {
        "auth": {
          "type": "noauth"
        },
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"token\": \"{{signedJwt}}\"\n}"
        },
        "url": {
          "raw": "https://{{lgsHost}}/link",
          "host": [
            "https://{{lgsHost}}"
          ],
          "path": [
            "link"
          ]
        },
        "description": "יוצר לינק הסכמה ללקוח הקצה. JWT עם srv: ais/user נחתם אוטומטית (RS512).\nבסביבת אינטגרציה: לבחור MockBank ולהזין PSU ID 999076599 (הסכמה תקינה לכל סוגי החשבונות).\nאחרי האישור תתקבל הודעת Webhook עם סטטוס valid, ואחריה Webhook שהנתונים זמינים."
      }
    },
    {
      "name": "2. Get Access Token (ais/tpp)",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "// ---- חתימת JWT (RS512) עבור srv: ais/tpp ----",
              "// אם הדבקתם JWT חתום ידנית במשתנה manualJwt - הוא ישמש במקום החתימה האוטומטית.",
              "const manual = pm.variables.get('manualJwt');",
              "if (manual && manual.trim()) {",
              "    pm.variables.set('signedJwt', manual.trim());",
              "    console.log('Using manualJwt');",
              "    return;",
              "}",
              "",
              "const now = Math.floor(Date.now() / 1000);",
              "const payload = {",
              "    sub: pm.variables.get('sub'),",
              "    iss: 'tpp/' + pm.variables.get('tppId'),",
              "    srv: 'ais/tpp',",
              "    iat: now,",
              "    exp: now + 600,",
              "    ttl: 600",
              "};",
              "",
              "function signAndStore() {",
              "    var navigator = {}; var window = {};",
              "    eval(pm.collectionVariables.get('jsrsasign_lib'));",
              "    let key = pm.variables.get('privateKey');",
              "    if (key === undefined || key === null || String(key).trim() === '') {",
              "        throw new Error('privateKey ריק - ודאו שה-Environment הנכון נבחר למעלה מימין ושהמפתח הודבק ב-Current value');",
              "    }",
              "    key = String(key).replace(/\\\\n/g, '\\n').replace(/\\r/g, '').trim();",
              "    if (key.includes('PASTE_YOUR_KEY')) {",
              "        throw new Error('privateKey עדיין מכיל את טקסט הדוגמה - הדביקו את המפתח האמיתי ב-Current value');",
              "    }",
              "    const header = { alg: 'RS512', typ: 'JWT' };",
              "    let candidates = [];",
              "    if (key.includes('PRIVATE KEY')) {",
              "        candidates.push(key);",
              "    } else {",
              "        // מפתח בלי שורות BEGIN/END: מנסים לעטוף אוטומטית",
              "        const b64 = key.replace(/\\s+/g, '');",
              "        const body = b64.match(/.{1,64}/g).join('\\n');",
              "        candidates.push('-----BEGIN PRIVATE KEY-----\\n' + body + '\\n-----END PRIVATE KEY-----');",
              "        candidates.push('-----BEGIN RSA PRIVATE KEY-----\\n' + body + '\\n-----END RSA PRIVATE KEY-----');",
              "    }",
              "    let jwt = null, lastErr = null;",
              "    for (const k of candidates) {",
              "        try { jwt = KJUR.jws.JWS.sign('RS512', JSON.stringify(header), JSON.stringify(payload), k); break; }",
              "        catch (e) { lastErr = e; }",
              "    }",
              "    if (!jwt) {",
              "        throw new Error('לא הצלחנו לקרוא את privateKey כמפתח RSA פרטי (PEM). התחלת הערך: ' + key.slice(0, 30) + '... | ' + lastErr);",
              "    }",
              "    pm.variables.set('signedJwt', jwt);",
              "    console.log('JWT payload (ais/tpp):', JSON.stringify(payload));",
              "}",
              "",
              "if (pm.collectionVariables.get('jsrsasign_lib')) {",
              "    signAndStore();",
              "} else {",
              "    pm.sendRequest('https://cdnjs.cloudflare.com/ajax/libs/jsrsasign/11.1.0/jsrsasign-all-min.js', (err, res) => {",
              "        if (err) { throw err; }",
              "        pm.collectionVariables.set('jsrsasign_lib', res.text());",
              "        signAndStore();",
              "    });",
              "}",
              ""
            ]
          }
        },
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test('Status 200', () => pm.response.to.have.status(200));",
              "const body = pm.response.json();",
              "const t = body.token || body.access_token;",
              "pm.test('Token returned', () => pm.expect(t).to.be.a('string'));",
              "pm.collectionVariables.set('accessToken', t);",
              "console.log('accessToken נשמר (תקף 600 שניות)');"
            ]
          }
        }
      ],
      "request": {
        "auth": {
          "type": "noauth"
        },
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"token\": \"{{signedJwt}}\"\n}"
        },
        "url": {
          "raw": "https://{{lgsHost}}/token",
          "host": [
            "https://{{lgsHost}}"
          ],
          "path": [
            "token"
          ]
        },
        "description": "מחזיר Bearer token לשליפת נתונים. JWT עם srv: ais/tpp. הטוקן תקף ל-600 שניות - כשפג, מריצים שוב את הבקשה הזו.\nהטוקן נשמר אוטומטית במשתנה accessToken ומשמש בכל הבקשות הבאות."
      }
    },
    {
      "name": "3. List Consents",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "",
              "if (pm.response.code === 307) {",
              "    const loc = pm.response.headers.get('Location') || '';",
              "    const m = loc.match(/transactionId=([^&]+)/);",
              "    if (m) {",
              "        pm.collectionVariables.set('transactionId', decodeURIComponent(m[1]));",
              "        console.log('307 - הנתונים עדיין נשלפים מהבנק. transactionId נשמר: ' + m[1] + ' - הריצו שוב את אותה בקשה (או את בקשת ה-Polling).');",
              "    }",
              "    pm.test('307 - data still being fetched, retry with transactionId', () => pm.expect(true).to.be.true);",
              "    return;",
              "}",
              "",
              "pm.test('Status 200', () => pm.response.to.have.status(200));",
              "const body = pm.response.json();",
              "const list = Array.isArray(body) ? body : (body.consents || body.items || []);",
              "const valid = list.find(c => c.status === 'valid') || list[0];",
              "if (valid) {",
              "    const id = valid.resourceId || valid.consentId || valid.id;",
              "    pm.collectionVariables.set('consentId', id);",
              "    console.log('consentId נשמר:', id, 'status:', valid.status);",
              "}"
            ]
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "https://{{tppHost}}/tpp/v1/users/{{sub}}@{{tppId}}/consents",
          "host": [
            "https://{{tppHost}}"
          ],
          "path": [
            "tpp",
            "v1",
            "users",
            "{{sub}}@{{tppId}}",
            "consents"
          ]
        },
        "description": "כל ההסכמות של המשתמש. ה-userId הוא תמיד {sub}@{tppId}. הבקשה שומרת את ה-consentId הראשון בסטטוס valid."
      }
    },
    {
      "name": "4. List Accounts (by consent)",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "",
              "if (pm.response.code === 307) {",
              "    const loc = pm.response.headers.get('Location') || '';",
              "    const m = loc.match(/transactionId=([^&]+)/);",
              "    if (m) {",
              "        pm.collectionVariables.set('transactionId', decodeURIComponent(m[1]));",
              "        console.log('307 - הנתונים עדיין נשלפים מהבנק. transactionId נשמר: ' + m[1] + ' - הריצו שוב את אותה בקשה (או את בקשת ה-Polling).');",
              "    }",
              "    pm.test('307 - data still being fetched, retry with transactionId', () => pm.expect(true).to.be.true);",
              "    return;",
              "}",
              "",
              "pm.test('Status 200', () => pm.response.to.have.status(200));",
              "const body = pm.response.json();",
              "const list = Array.isArray(body) ? body : (body.accounts || body.items || []);",
              "if (list.length) {",
              "    // בוחרים חשבון ראשון שיש לו תנועות (_hasTransactions), אחרת הראשון ברשימה",
              "    const a = list.find(x => x._hasTransactions) || list[0];",
              "    const id = a.resourceId || a.accountId || a.id;",
              "    pm.collectionVariables.set('accountId', id);",
              "    const withTx = list.filter(x => x._hasTransactions).map(x => x.resourceId);",
              "    console.log('accountId נשמר:', id, '| סה\"כ חשבונות:', list.length, '| חשבונות עם תנועות:', withTx.join(', '));",
              "}"
            ]
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "https://{{tppHost}}/tpp/v1/users/{{sub}}@{{tppId}}/consents/{{consentId}}/accounts?withBalances=true",
          "host": [
            "https://{{tppHost}}"
          ],
          "path": [
            "tpp",
            "v1",
            "users",
            "{{sub}}@{{tppId}}",
            "consents",
            "{{consentId}}",
            "accounts"
          ],
          "query": [
            {
              "key": "withBalances",
              "value": "true"
            }
          ]
        },
        "description": "חשבונות העו\"ש תחת ההסכמה. ה-resourceId של כל חשבון משמש לשליפת יתרות ותנועות. הבקשה שומרת את החשבון הראשון במשתנה accountId - אפשר להחליף ידנית."
      }
    },
    {
      "name": "5. Account Balances",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "",
              "if (pm.response.code === 307) {",
              "    const loc = pm.response.headers.get('Location') || '';",
              "    const m = loc.match(/transactionId=([^&]+)/);",
              "    if (m) {",
              "        pm.collectionVariables.set('transactionId', decodeURIComponent(m[1]));",
              "        console.log('307 - הנתונים עדיין נשלפים מהבנק. transactionId נשמר: ' + m[1] + ' - הריצו שוב את אותה בקשה (או את בקשת ה-Polling).');",
              "    }",
              "    pm.test('307 - data still being fetched, retry with transactionId', () => pm.expect(true).to.be.true);",
              "    return;",
              "}",
              "",
              "pm.test('Status 200', () => pm.response.to.have.status(200));"
            ]
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "https://{{tppHost}}/tpp/v1/users/{{sub}}@{{tppId}}/consents/{{consentId}}/accounts/{{accountId}}/balances",
          "host": [
            "https://{{tppHost}}"
          ],
          "path": [
            "tpp",
            "v1",
            "users",
            "{{sub}}@{{tppId}}",
            "consents",
            "{{consentId}}",
            "accounts",
            "{{accountId}}",
            "balances"
          ]
        },
        "description": "יתרות החשבון."
      }
    },
    {
      "name": "6. Account Transactions v2 (paginated)",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "// ברירת מחדל: 90 יום אחורה עד היום, אם לא הוגדר dateFrom/dateTo",
              "const fmt = d => d.toISOString().slice(0, 10);",
              "if (!pm.variables.get('dateTo')) pm.collectionVariables.set('dateTo', fmt(new Date()));",
              "if (!pm.variables.get('dateFrom')) pm.collectionVariables.set('dateFrom', fmt(new Date(Date.now() - 90 * 864e5)));",
              "if (pm.variables.get('page') === undefined || pm.variables.get('page') === '') pm.collectionVariables.set('page', '0');"
            ]
          }
        },
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "",
              "if (pm.response.code === 307) {",
              "    const loc = pm.response.headers.get('Location') || '';",
              "    const m = loc.match(/transactionId=([^&]+)/);",
              "    if (m) {",
              "        pm.collectionVariables.set('transactionId', decodeURIComponent(m[1]));",
              "        console.log('307 - הנתונים עדיין נשלפים מהבנק. transactionId נשמר: ' + m[1] + ' - הריצו שוב את אותה בקשה (או את בקשת ה-Polling).');",
              "    }",
              "    pm.test('307 - data still being fetched, retry with transactionId', () => pm.expect(true).to.be.true);",
              "    return;",
              "}",
              "",
              "pm.test('Status 200', () => pm.response.to.have.status(200));",
              "const body = pm.response.json();",
              "console.log('Transactions response keys:', Object.keys(body));",
              "// לכל תנועה יש transactionId יציב של פיזבק - להשתמש בו למניעת כפילויות בהתאמות"
            ]
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "https://{{tppHost}}/tpp/v2/users/{{sub}}@{{tppId}}/consents/{{consentId}}/accounts/{{accountId}}/transactions?bookingStatus=booked&dateFrom={{dateFrom}}&dateTo={{dateTo}}&page={{page}}&pageSize=100",
          "host": [
            "https://{{tppHost}}"
          ],
          "path": [
            "tpp",
            "v2",
            "users",
            "{{sub}}@{{tppId}}",
            "consents",
            "{{consentId}}",
            "accounts",
            "{{accountId}}",
            "transactions"
          ],
          "query": [
            {
              "key": "bookingStatus",
              "value": "booked",
              "description": "חובה: booked | pending | both"
            },
            {
              "key": "dateFrom",
              "value": "{{dateFrom}}",
              "description": "YYYY-MM-DD"
            },
            {
              "key": "dateTo",
              "value": "{{dateTo}}",
              "description": "YYYY-MM-DD"
            },
            {
              "key": "page",
              "value": "{{page}}",
              "description": "מתחיל מ-0"
            },
            {
              "key": "pageSize",
              "value": "100",
              "description": "ברירת מחדל 100, מקסימום 1000"
            }
          ]
        },
        "description": "תנועות החשבון - הקריאה המרכזית להתאמות בנקים.\n- bookingStatus חובה (booked לתנועות שנרשמו).\n- Pagination: page מתחיל מ-0, pageSize עד 1000. להעלות page עד שמתקבל עמוד ריק/חלקי.\n- לכל תנועה יש transactionId יציב - מומלץ להשתמש בו למניעת כפילויות.\n- 307 = הנתונים עדיין נשלפים מהבנק: ה-transactionId מה-Location header נשמר, ומריצים את בקשה 7.\n- תנועות נשלפות רק ב-v2. הסכמות, חשבונות ויתרות נשארים ב-v1.\n- אם חוזר 403 (no identity-based policy), יש לפנות לפיזבק כדי לאפשר v2 ל-TPP."
      },
      "protocolProfileBehavior": {
        "followRedirects": false
      }
    },
    {
      "name": "7. Polling after 307 (transactionId)",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "",
              "if (pm.response.code === 307) {",
              "    const loc = pm.response.headers.get('Location') || '';",
              "    const m = loc.match(/transactionId=([^&]+)/);",
              "    if (m) {",
              "        pm.collectionVariables.set('transactionId', decodeURIComponent(m[1]));",
              "        console.log('307 - הנתונים עדיין נשלפים מהבנק. transactionId נשמר: ' + m[1] + ' - הריצו שוב את אותה בקשה (או את בקשת ה-Polling).');",
              "    }",
              "    pm.test('307 - data still being fetched, retry with transactionId', () => pm.expect(true).to.be.true);",
              "    return;",
              "}",
              "",
              "pm.test('Status 200', () => pm.response.to.have.status(200));"
            ]
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "X-Request-Wait",
            "value": "10000",
            "description": "אופציונלי: כמה מ\"ש לחכות לבנק לפני החזרת 307"
          }
        ],
        "url": {
          "raw": "https://{{tppHost}}/tpp/v2/users/{{sub}}@{{tppId}}/consents/{{consentId}}/accounts/{{accountId}}/transactions?bookingStatus=booked&dateFrom={{dateFrom}}&dateTo={{dateTo}}&page={{page}}&pageSize=100&transactionId={{transactionId}}",
          "host": [
            "https://{{tppHost}}"
          ],
          "path": [
            "tpp",
            "v2",
            "users",
            "{{sub}}@{{tppId}}",
            "consents",
            "{{consentId}}",
            "accounts",
            "{{accountId}}",
            "transactions"
          ],
          "query": [
            {
              "key": "bookingStatus",
              "value": "booked"
            },
            {
              "key": "dateFrom",
              "value": "{{dateFrom}}"
            },
            {
              "key": "dateTo",
              "value": "{{dateTo}}"
            },
            {
              "key": "page",
              "value": "{{page}}"
            },
            {
              "key": "pageSize",
              "value": "100"
            },
            {
              "key": "transactionId",
              "value": "{{transactionId}}",
              "description": "מתוך ה-Location header של תשובת 307"
            }
          ]
        },
        "description": "המשך שליפה אחרי 307: אותה קריאה + transactionId שהוחזר ב-Location header. מריצים שוב עד שמתקבל 200."
      },
      "protocolProfileBehavior": {
        "followRedirects": false
      }
    }
  ],
  "variable": [
    {
      "key": "accessToken",
      "value": ""
    },
    {
      "key": "consentId",
      "value": ""
    },
    {
      "key": "accountId",
      "value": ""
    },
    {
      "key": "transactionId",
      "value": ""
    },
    {
      "key": "consentLink",
      "value": ""
    },
    {
      "key": "dateFrom",
      "value": ""
    },
    {
      "key": "dateTo",
      "value": ""
    },
    {
      "key": "page",
      "value": ""
    },
    {
      "key": "jsrsasign_lib",
      "value": ""
    }
  ]
}

Did this page help you?