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

# Get Transaction

> Retrieve a single transaction by internal ID or external ID — in the gu1 transaction monitoring API for fraud and AML, with examples for get use cases.

## Overview

Returns one transaction for your organization. The response shape uses nested **`origin`** and **`destination`** objects (with resolved entity data when available). This differs from [Create transaction](/en/api-reference/transactions/create), which uses flatter `originDetails` / `destinationDetails` on the request body.

The rules engine is **not** re-run on read. By default the response does **not** include `rulesExecutionSummary`. Pass **`includeRulesSummary=full`** to attach the latest persisted rules summary to the **`persisted`** object (same shape as [Rules execution summary](/en/api-reference/rules-execution-summary)).

## Endpoints

| Method             | Endpoint                                  | Use when                                        |
| ------------------ | ----------------------------------------- | ----------------------------------------------- |
| **By ID**          | `GET /transactions/{id}`                  | You have gu1’s transaction UUID                 |
| **By external ID** | `GET /transactions/external/{externalId}` | You only have your own `externalId` from create |

Both return the same JSON shape: `{ "transaction": { ... }, "persisted": { ... }, "baseCurrency": "..." }`.

## Query Parameters

<ParamField query="includeRulesSummary" type="string">
  Optional. When omitted, behavior is unchanged (no rules summary on read).

  * **`full`** — Loads the **latest** `risk_analysis_audits` row for this transaction and adds **`persisted.rulesExecutionSummary`** (`rulesHit`, `rulesNoHit`, `actionsExecuted`, scores, etc.). Does **not** execute rules again. Intended for single-transaction detail / debugging; omit on high-volume polling.
</ParamField>

### Get by ID

```
GET http://api.gu1.ai/transactions/{id}
```

<ParamField path="id" type="string" required>
  Transaction UUID in gu1 (same as `transaction.id` from create).
</ParamField>

### Get by External ID

```
GET http://api.gu1.ai/transactions/external/{externalId}
```

<ParamField path="externalId" type="string" required>
  The `externalId` you sent when creating the transaction.
</ParamField>

## Authentication

Requires a valid API key and permission to read transactions (`transactions:read`):

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

The transaction must belong to the organization tied to your key. Otherwise the API responds with **404**.

## Response (200 OK)

<ResponseField name="transaction" type="object">
  Full transaction record.

  * **id** (string) — gu1 transaction UUID
  * **externalId** (string) — your external identifier
  * **type**, **status** — enums (same semantics as create)
  * **amount** (number), **currency** (string)
  * **amountInUsd** (number | null) — converted amount when available
  * **currenciesExchange** (array) — per-currency conversion entries `{ currency, exchangeRate, value }`
  * **paymentMethod** (string | null)
  * **origin** (object) — `entityId`, `externalId`, `name`, `country`, `type` (`person` | `company` | null), `taxId`, `riskScore`, `details` (object; includes payment-related data you stored)
  * **destination** (object) — same structure as **origin**
  * **riskScore** (number | null)
  * **lastRiskEvaluationAt** (string | null) — ISO timestamp of the latest risk analysis audit for this transaction (**present on GET by UUID**; omitted when fetching by external ID)
  * **riskFactors** (array) — structured reasons / matches from the last evaluation
  * **activeMatchesCount**, **shadowMatchesCount** (number, optional) — when present on stored evaluation metadata
  * **hitRuleExternalIds** (string\[], optional) — external IDs of rules that matched
  * **flagged** (boolean)
  * **locationDetails**, **deviceDetails** (object)
  * **channel** (string | null), **timeZone** (string | null) — IANA zone when set on create
  * **description**, **category**, **metadata** (object)
  * **transactedAt**, **createdAt**, **updatedAt** (ISO strings)
  * **exchangeRate**, **rateSource**, **rateTimestamp**, **convertedAt** — conversion metadata when applicable
</ResponseField>

<ResponseField name="persisted" type="object">
  Flat camelCase snapshot of the row stored in `transactions` (same field names as create / rules engine input): amounts, counterparties, `metadata`, `riskFactors`, etc.

  When **`includeRulesSummary=full`**, may also include:

  * **rulesExecutionSummary** (object) — latest persisted rules run for this transaction (not a live re-evaluation). Omitted when no audit exists or when the query param is not sent.
</ResponseField>

<ResponseField name="baseCurrency" type="string">
  Organization base currency (ISO code, e.g. `USD`), used as reference for multi-currency displays.
</ResponseField>

### Example (by ID, with rules summary)

```bash theme={null}
curl -s 'http://api.gu1.ai/transactions/550e8400-e29b-41d4-a716-446655440000?includeRulesSummary=full' \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```json theme={null}
{
  "transaction": { "...": "..." },
  "persisted": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "externalId": "txn_12345",
    "amount": 150.5,
    "currency": "USD",
    "riskFactors": {},
    "metadata": {},
    "rulesExecutionSummary": {
      "rulesHit": [],
      "rulesNoHit": [],
      "totalScore": 0,
      "actionsExecuted": {}
    }
  },
  "baseCurrency": "USD"
}
```

### Example (by ID, default)

```bash theme={null}
curl -s http://api.gu1.ai/transactions/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```json theme={null}
{
  "transaction": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "externalId": "txn_12345",
    "type": "PAYMENT",
    "status": "CREATED",
    "amount": 150.5,
    "currency": "USD",
    "amountInUsd": 150.5,
    "currenciesExchange": [],
    "paymentMethod": "CARD",
    "origin": {
      "entityId": "…",
      "externalId": "customer_001",
      "name": "Jane Doe",
      "country": "US",
      "type": "person",
      "taxId": null,
      "riskScore": 12.5,
      "details": {}
    },
    "destination": {
      "entityId": "…",
      "externalId": "merchant_456",
      "name": "Acme Store",
      "country": "US",
      "type": "company",
      "taxId": null,
      "riskScore": 8,
      "details": {}
    },
    "riskScore": 15,
    "lastRiskEvaluationAt": "2025-01-15T10:00:00.000Z",
    "riskFactors": [],
    "flagged": false,
    "locationDetails": {},
    "deviceDetails": {},
    "channel": "web_browser",
    "description": "Online purchase",
    "category": "retail",
    "metadata": {},
    "transactedAt": "2025-01-15T09:55:00.000Z",
    "createdAt": "2025-01-15T09:55:01.000Z",
    "updatedAt": "2025-01-15T09:55:01.000Z",
    "exchangeRate": null,
    "rateSource": null,
    "rateTimestamp": null,
    "convertedAt": null
  },
  "baseCurrency": "USD"
}
```

## Error Responses

### 400 — Invalid query

```json theme={null}
{
  "error": "Invalid query parameters",
  "details": []
}
```

Returned when `includeRulesSummary` is not `full`.

### 404 — Not found

```json theme={null}
{
  "error": "Transaction not found"
}
```

Returned when the ID does not exist or belongs to another organization.

### 500 — Server error

```json theme={null}
{
  "error": "Failed to fetch transaction",
  "details": "…"
}
```

## Related

* [Create transaction](/en/api-reference/transactions/create)
* [Rules execution summary](/en/api-reference/rules-execution-summary)
* [Create batch transactions](/en/api-reference/transactions/create-batch)
* [Change transaction status](/en/use-cases/transaction-monitoring/change-status-api)
