Request Correlation
Basis Theory utilizes Correlation IDs to assist with request tracing, logging, and debugging.
All API endpoints accept a client-provided Correlation ID if sent with the BT-TRACE-ID
HTTP header within POST, PUT, PATCH, DELETE methods.
If a BT-TRACE-ID
Correlation ID is not provided by the client, a new Correlation ID will be generated by the Basis Theory API.
Example
- cURL
- JavaScript
- C#
- Python
- Go
curl "https://api.basistheory.com" \
-H "BT-API-KEY: <API_KEY>" \
-H "BT-TRACE-ID: aa5d3379-6385-4ef4-9fdb-ca1341572153"
import { BasisTheory } from "@basis-theory/basis-theory-js";
const bt = await new BasisTheory().init("<MANAGEMENT_API_KEY>");
const applications = await bt.applications.list(
{},
{
correlationId: "aa5d3379-6385-4ef4-9fdb-ca1341572153",
}
);
var correlationId = Guid.NewGuid().ToString();
var apiInstance = new TokensApi(configuration);
var response = await apiInstance.GetByIdWithHttpInfoAsync("...",
requestOptions: new RequestOptions
{
CorrelationId = correlationId
});
response.Headers.TryGetValue("BT-TRACE-ID", out IList<string> correlationIds);
import basistheory
from basistheory.api import tokens_api
# At instance
api_client = basistheory.ApiClient(configuration=basistheory.Configuration(api_key="<PRIVATE_API_KEY>"))
client = tokens_api.TokensApi(api_client)
# Per call
client.list(request_options=basistheory.RequestOptions(correlation_id="aa5d3379-6385-4ef4-9fdb-ca1341572153"))