# Transactions Service API

Base URL: `https://interact-uat.hsbc.com/yi-transactions-service/`

### GET /v1/transactions/history

**Get raw HSBCnet-compatible transaction history**

Returns transaction history in the raw HSBCnet-compatible `responseBody` and `stmtTranList` structure. Use header `test: 1` to return seeded in-memory data instead of calling a downstream service. Configured synthetic customer IDs are served from test-data-viewer automatically, bypassing DSP and HSBCnet, and are adapted to the same raw response structure.

Requires authentication: **neoSessionCookie** (cookie) or **xHSBCCustIdHeader** (header) or **b2bBearerToken** (header)


#### Parameters

| Name | In | Type | Description |
|---|---|---|---|
| `X-HSBC-Account-Id` | header | string *(required)* | HSBC account identifier for the requested transaction history. |
| `X-HSBC-Account-Currency` | header | string | Optional account currency used to label returned amounts. |
| `X-HSBC-Request-Correlation-Id` | header | string | Optional caller-provided correlation identifier. |
| `X-HSBC-CUSTID` | header | string | Customer identifier used for the customer-id header authentication journey. |
| `test` | header | string | Set to 1 to serve seeded in-memory data instead of calling the upstream transaction-history service. |
| `lookbackDays` | query | integer | Number of days of transaction history to request. |


#### Responses

- **200** — Raw transaction history retrieved successfully
- **400** — Invalid request parameters or missing required headers.
- **401** — Missing or invalid authentication.
- **403** — Caller is authenticated but not entitled for the requested account.
- **500** — Unexpected service failure.
- **502** — Downstream transaction-history service returned an invalid or failing response.


#### Examples

```bash
curl "https://interact-uat.hsbc.com/yi-transactions-service/v1/transactions/history" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "X-HSBC-Account-Id: YOUR_X_HSBC_ACCOUNT_ID" \
  -H "X-HSBC-Account-Currency: YOUR_X_HSBC_ACCOUNT_CURRENCY" \
  -H "X-HSBC-Request-Correlation-Id: YOUR_X_HSBC_REQUEST_CORRELATION_ID" \
  -H "X-HSBC-CUSTID: YOUR_X_HSBC_CUSTID" \
  -H "test: YOUR_TEST"
```

```javascript
const response = await fetch("https://interact-uat.hsbc.com/yi-transactions-service/v1/transactions/history", {
  headers: {
      "Authorization": "Bearer YOUR_TOKEN",
      "X-HSBC-Account-Id": "YOUR_X_HSBC_ACCOUNT_ID",
      "X-HSBC-Account-Currency": "YOUR_X_HSBC_ACCOUNT_CURRENCY",
      "X-HSBC-Request-Correlation-Id": "YOUR_X_HSBC_REQUEST_CORRELATION_ID",
      "X-HSBC-CUSTID": "YOUR_X_HSBC_CUSTID",
      "test": "YOUR_TEST"
  },
});

const data = await response.json();
```

```python
import requests

url = "https://interact-uat.hsbc.com/yi-transactions-service/v1/transactions/history"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "X-HSBC-Account-Id": "YOUR_X_HSBC_ACCOUNT_ID",
    "X-HSBC-Account-Currency": "YOUR_X_HSBC_ACCOUNT_CURRENCY",
    "X-HSBC-Request-Correlation-Id": "YOUR_X_HSBC_REQUEST_CORRELATION_ID",
    "X-HSBC-CUSTID": "YOUR_X_HSBC_CUSTID",
    "test": "YOUR_TEST",
}

response = requests.get(url, headers=headers)
print(response.json())
```

```java
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://interact-uat.hsbc.com/yi-transactions-service/v1/transactions/history"))
    .header("Authorization", "Bearer YOUR_TOKEN")
    .header("X-HSBC-Account-Id", "YOUR_X_HSBC_ACCOUNT_ID")
    .header("X-HSBC-Account-Currency", "YOUR_X_HSBC_ACCOUNT_CURRENCY")
    .header("X-HSBC-Request-Correlation-Id", "YOUR_X_HSBC_REQUEST_CORRELATION_ID")
    .header("X-HSBC-CUSTID", "YOUR_X_HSBC_CUSTID")
    .header("test", "YOUR_TEST")
    .GET()
    .build();

HttpResponse<String> response = client.send(
    request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

#### Example response

```json
{
  "responseBody": {
    "accountId": "GBHRFBCA40117703000087",
    "totalCount": "1",
    "pagingInfo": {
      "startIndex": "0",
      "endIndex": "0",
      "isMoreRec": "N"
    },
    "sortInfo": {
      "sortColumn": "PD",
      "sortOrder": "D"
    },
    "stmtTranList": [
      {
        "lastUpdtTmStmp": "2026-08-04T09:44:48.427694Z",
        "bosPostDt": "2026-08-03",
        "seqNo": "1",
        "bosLastTmStmp": "2026-08-04T10:44:48Z",
        "narrative": {
          "rawNarrative": "/REMI/Example remittance narrative",
          "shortNarrative": "N",
          "normalizedNarrative": [
            "/REMI/Example remittance narrative"
          ]
        },
        "bosPostTmStamp": "07.42.32",
        "amt": "-67.89",
        "rvrslInd": "N",
        "type": {
          "isoFamCode": "MDOP",
          "cfonbCode": "44",
          "bosCode": "TT",
          "orginalCode": "-0072",
          "btrCode": "TT",
          "baiCode": "0495",
          "isoDomnCode": "PMNT",
          "swiftCode": "NTRF",
          "isoSubFamCode": "OTHR"
        },
        "tC": "S",
        "crDbInd": "D",
        "ref": {
          "bank": "RBE03086K8JOQ60W",
          "channel": "RBE03086K8JOQ60W",
          "customer": "Example customer reference"
        },
        "postDate": "2026-08-03",
        "blendedTransactionParty": "Example remittance party",
        "blendedTransactionReference": null,
        "valDt": "2026-08-03",
        "openingBalance": "",
        "runningBalance": "",
        "closingBalance": ""
      }
    ]
  },
  "statusCode": "200"
}
```

