Skip to main content
PATCH
/
transactions
/
{id}
Update Transaction
curl --request PATCH \
  --url http://api.gu1.ai/transactions/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "metadata": {},
  "deviceDetails": {},
  "channel": {},
  "reason": "<string>"
}
'

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.

Overview

Use this endpoint when you need to enrich or correct an existing transaction after creation: custom metadata, deviceDetails, channel, or reason. It does not change amount, status, parties, or other core fields (use Change status for status).
Shallow merge for metadata and deviceDetails: only keys you send are overwritten; omitted keys are preserved. Nested objects (e.g. metadata.tags) are replaced as a whole when you send that key. To clear channel, send "channel": null.

Endpoints

MethodEndpointUse when
By IDPATCH /transactions/{id}You have gu1’s transaction UUID
By external IDPATCH /transactions/external/{externalId}You only have your externalId from create
Both accept the same JSON body and return the same response shape.
PATCH https://api.gu1.ai/transactions/{id}
PATCH https://api.gu1.ai/transactions/external/{externalId}

Authentication

Requires transactions:edit (API key or session with equivalent permission):
Authorization: Bearer YOUR_API_KEY

Query parameters

executeRules
boolean
default:"false"
When true, re-runs KYT rules with trigger transaction_updated after the patch (same mode as status change). Default: false.

Request body

At least one field is required.
metadata
object
Shallow merge into existing metadata. Example: existing { "purpose": "payroll", "tags": { "a": 1 } } + body { "tags": { "b": 2 } }{ "purpose": "payroll", "tags": { "b": 2 } } (top-level tags is replaced as a whole).
deviceDetails
object
Shallow merge into existing deviceDetails (stored in device_details). Use this to add or correct device context after create — e.g. ipAddress, deviceId, osName, manufacturer, model, fraud flags (isVpn, isEmulator, …). Same field schema as Create transaction (deviceDetails). Rules evaluate paths like deviceDetails.ipAddress.
channel
string | null
Transaction channel (max 50 chars), e.g. web, mobile, api. Send null to clear.
reason
string
Outcome / decline reason enum. See Reason enum.

Example

{
  "metadata": {
    "clientReference": "INV-2026-0042",
    "tags": { "segment": "retail" }
  },
  "deviceDetails": {
    "ipAddress": "203.0.113.10",
    "deviceId": "dev-abc-123",
    "osName": "iOS",
    "osVersion": "17.0",
    "manufacturer": "Apple",
    "model": "iPhone"
  },
  "channel": "mobile",
  "reason": "FRAUD_SUSPECTED"
}

Response (200 OK)

{
  "success": true,
  "transaction": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "externalId": "tx_12345",
    "channel": "mobile",
    "reason": "FRAUD_SUSPECTED",
    "metadata": {
      "purpose": "payroll",
      "clientReference": "INV-2026-0042",
      "tags": { "segment": "retail" }
    },
    "deviceDetails": {
      "ipAddress": "203.0.113.10",
      "deviceId": "dev-abc-123",
      "osName": "iOS"
    },
    "updatedAt": "2026-05-29T12:00:00.000Z"
  }
}
When executeRules=true, rulesExecutionSummary is included (same shape as create / change status).

Errors

StatusCodeWhen
400VALIDATION_ERRORInvalid body or no effective change
400NO_CHANGESValues match what is already stored
404NOT_FOUNDTransaction not in your organization
403Missing transactions:edit

Side effects

  • Audit: transaction_updated event on the transaction timeline with changed fields (metadata, deviceDetails, channel, and/or reason in changes).
  • Webhook: transaction.updated (includes changes and current deviceDetails when applicable).
  • Rules: only when executeRules=true.

Examples

curl -X PATCH "https://api.gu1.ai/transactions/external/tx_12345" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "metadata": { "note": "Corrected after bank callback" },
    "channel": "api"
  }'

Get transaction

Read full transaction after update

Change status

Update lifecycle status and re-run rules

Create transaction

Initial metadata on create

Reason enum

Allowed reason values