Gate Transactions
Gate transaction endpoints provide access to vehicle and container processing records from Gate OS. Use these endpoints to query transaction history, retrieve detailed inspection results, and override automated decisions.
GET /api/v1/transactions
List gate transactions with filtering and pagination.
Request
curl "https://api.turqoa.com/v1/transactions?status=flagged&gate=gate_1&per_page=20" \
-H "Authorization: Bearer $TURQOA_API_KEY"
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
status | string | all | Filter by status: approved, flagged, held, overridden, rejected |
gate | string | all | Filter by gate ID |
start_date | string | 24h ago | ISO 8601 start date |
end_date | string | now | ISO 8601 end date |
container_id | string | -- | Filter by container ID (exact or prefix match) |
vehicle_plate | string | -- | Filter by vehicle license plate |
decision | string | -- | Filter by decision: auto_approved, manual_review, auto_rejected |
sort | string | created_at | Sort field: created_at, risk_score, gate |
order | string | desc | Sort direction: asc or desc |
page | integer | 1 | Page number |
per_page | integer | 50 | Items per page (max 200) |
Response
{
"data": [
{
"id": "txn_20260406_001",
"gate": "gate_1",
"status": "flagged",
"decision": "manual_review",
"created_at": "2026-04-06T08:15:32Z",
"completed_at": null,
"vehicle": {
"plate": "ABC 1234",
"plate_confidence": 0.97,
"type": "truck",
"carrier": "Maersk Line"
},
"container": {
"id": "MSCU1234567",
"ocr_confidence": 0.94,
"iso_type": "22G1",
"size": "20ft",
"seal": {
"number": "SL98765",
"status": "intact",
"confidence": 0.91
}
},
"inspection": {
"damage_detected": false,
"ocr_match": true,
"seal_verified": true,
"anomalies": [
{
"type": "weight_discrepancy",
"message": "Declared weight 18,200 kg, estimated 22,400 kg",
"severity": "medium"
}
]
},
"risk_score": 45,
"processing_time_ms": 1230,
"operator": null
}
],
"meta": {
"request_id": "req_def456",
"timestamp": "2026-04-06T10:00:00Z"
},
"pagination": {
"page": 1,
"per_page": 20,
"total_items": 847,
"total_pages": 43,
"has_next": true,
"has_previous": false
}
}
Code Examples
Python
import requests
response = requests.get(
"https://api.turqoa.com/v1/transactions",
headers={"Authorization": f"Bearer {api_key}"},
params={
"status": "flagged",
"gate": "gate_1",
"start_date": "2026-04-06T00:00:00Z",
"per_page": 20,
},
)
transactions = response.json()["data"]
for txn in transactions:
print(f"{txn['id']}: {txn['container']['id']} - {txn['status']}")
Node.js
const response = await fetch(
"https://api.turqoa.com/v1/transactions?" +
new URLSearchParams({
status: "flagged",
gate: "gate_1",
start_date: "2026-04-06T00:00:00Z",
per_page: "20",
}),
{
headers: { Authorization: `Bearer ${apiKey}` },
}
);
const { data: transactions } = await response.json();
transactions.forEach((txn) => {
console.log(`${txn.id}: ${txn.container.id} - ${txn.status}`);
});
GET /api/v1/transactions/:id
Retrieve a single transaction with full detail including the complete inspection report, evidence images, and audit trail.
Request
curl https://api.turqoa.com/v1/transactions/txn_20260406_001 \
-H "Authorization: Bearer $TURQOA_API_KEY"
Response
{
"data": {
"id": "txn_20260406_001",
"gate": "gate_1",
"status": "flagged",
"decision": "manual_review",
"created_at": "2026-04-06T08:15:32Z",
"completed_at": null,
"vehicle": {
"plate": "ABC 1234",
"plate_confidence": 0.97,
"plate_image_url": "https://evidence.turqoa.com/txn_001/plate.jpg",
"type": "truck",
"carrier": "Maersk Line",
"driver_id": "DRV-5521",
"appointment_id": "APT-2026040608-003"
},
"container": {
"id": "MSCU1234567",
"ocr_confidence": 0.94,
"ocr_image_url": "https://evidence.turqoa.com/txn_001/container_id.jpg",
"iso_type": "22G1",
"size": "20ft",
"weight_declared_kg": 18200,
"weight_estimated_kg": 22400,
"seal": {
"number": "SL98765",
"status": "intact",
"confidence": 0.91,
"seal_image_url": "https://evidence.turqoa.com/txn_001/seal.jpg"
}
},
"inspection": {
"damage_detected": false,
"damage_regions": [],
"ocr_match": true,
"seal_verified": true,
"anomalies": [
{
"type": "weight_discrepancy",
"message": "Declared weight 18,200 kg, estimated 22,400 kg",
"severity": "medium",
"confidence": 0.88
}
],
"images": [
{
"type": "front",
"url": "https://evidence.turqoa.com/txn_001/front.jpg",
"captured_at": "2026-04-06T08:15:30Z"
},
{
"type": "left_side",
"url": "https://evidence.turqoa.com/txn_001/left.jpg",
"captured_at": "2026-04-06T08:15:31Z"
},
{
"type": "right_side",
"url": "https://evidence.turqoa.com/txn_001/right.jpg",
"captured_at": "2026-04-06T08:15:31Z"
},
{
"type": "rear",
"url": "https://evidence.turqoa.com/txn_001/rear.jpg",
"captured_at": "2026-04-06T08:15:32Z"
}
]
},
"risk_score": 45,
"risk_factors": [
{ "factor": "weight_discrepancy", "score": 35, "weight": 0.30 },
{ "factor": "first_visit_carrier", "score": 20, "weight": 0.15 },
{ "factor": "off_peak_arrival", "score": 15, "weight": 0.10 }
],
"processing_time_ms": 1230,
"audit_trail": [
{
"action": "transaction_created",
"timestamp": "2026-04-06T08:15:32Z",
"actor": "system"
},
{
"action": "inspection_completed",
"timestamp": "2026-04-06T08:15:33Z",
"actor": "system",
"details": "1 anomaly detected"
},
{
"action": "flagged_for_review",
"timestamp": "2026-04-06T08:15:33Z",
"actor": "decision_engine",
"rule": "weight_discrepancy_review"
}
]
}
}
POST /api/v1/transactions/:id/override
Override an automated gate decision. Requires transactions:write scope. Used when an operator reviews a flagged transaction and makes a manual decision.
Request
curl -X POST https://api.turqoa.com/v1/transactions/txn_20260406_001/override \
-H "Authorization: Bearer $TURQOA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"decision": "approved",
"reason": "Weight discrepancy within acceptable range after manual check",
"operator_id": "op_jsmith",
"notes": "Verified with shipping manifest. Discrepancy due to dunnage weight."
}'
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
decision | string | Yes | New decision: approved or rejected |
reason | string | Yes | Reason for the override (for audit trail) |
operator_id | string | Yes | ID of the operator making the override |
notes | string | No | Additional notes |
gate_action | string | No | Immediate gate action: open, hold, lock (defaults to matching decision) |
Response
{
"data": {
"id": "txn_20260406_001",
"status": "overridden",
"previous_decision": "manual_review",
"new_decision": "approved",
"overridden_by": "op_jsmith",
"overridden_at": "2026-04-06T08:20:15Z",
"reason": "Weight discrepancy within acceptable range after manual check",
"gate_action": "open",
"gate_action_executed": true
}
}
Override Constraints
- Only transactions with status
flaggedorheldcan be overridden - Overriding a
rejectedtransaction requiresadminscope - All overrides are logged in the audit trail and cannot be deleted
- Override reason is required and must be at least 10 characters
Error Responses
Transaction already completed:
{
"error": {
"code": "resource_conflict",
"message": "Transaction txn_20260406_001 is already in status 'approved' and cannot be overridden.",
"request_id": "req_xyz789"
}
}
Response Schema
Transaction Object
| Field | Type | Description |
|---|---|---|
id | string | Unique transaction ID |
gate | string | Gate identifier |
status | string | Current status |
decision | string | Decision type |
created_at | string | ISO 8601 timestamp |
completed_at | string or null | ISO 8601 timestamp |
vehicle | object | Vehicle details |
vehicle.plate | string | License plate text |
vehicle.plate_confidence | number | OCR confidence (0-1) |
vehicle.type | string | Vehicle type |
vehicle.carrier | string | Carrier/shipping line |
container | object | Container details |
container.id | string | Container ID |
container.ocr_confidence | number | OCR confidence (0-1) |
container.iso_type | string | ISO container type code |
container.size | string | Container size |
container.seal | object | Seal inspection details |
inspection | object | Full inspection results |
inspection.damage_detected | boolean | Whether damage was found |
inspection.anomalies | array | List of anomaly objects |
risk_score | number | Composite risk score (0-100) |
processing_time_ms | number | Total processing time |
operator | string or null | Assigned operator ID |