Header x-transaction-id

X-Transaction-ID Header

Overview

All requests to Astrapay APIs must include a header named x-transaction-id. This header contains a UUID generated and sent by the client, serving as a unique identifier for each request.

Purpose

The x-transaction-id acts as a unique identifier for each request, allowing for efficient tracking and troubleshooting across our systems. In case of an issue or incident, the client only needs to provide this identifier, enabling our team to quickly locate and analyze the corresponding request in our logs and monitoring tools.

Usage

Header Format

x-transaction-id: <unique-uuid>

Example

x-transaction-id: 550e8400-e29b-41d4-a716-446655440000

Benefits

Including a unique transaction ID in every request enhances observability and traceability within distributed systems. When all services propagate the same x-transaction-id, it becomes possible to:

  • Correlate logs, metrics, and traces across multiple microservices
  • Quickly identify the flow of a specific request end-to-end
  • Reduce investigation time in case of performance issues or failures
  • Improve collaboration between support and development teams during incident analysis

Error Response Correlation

When an error occurs, the response will include the same xTransactionId in the error object:

{
  "errorCode": 400,
  "message": "Invalid request parameters",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "xTransactionId": "550e8400-e29b-41d4-a716-446655440000",
  "errors": ["Amount must be greater than 0.01"]
}

This allows you to correlate the error response with your original request using the same transaction ID.


The x-transaction-id header is essential for maintaining observability and enabling efficient support across all Astrapay APIs.