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
- Node
- JavaScript (legacy)
- C#
- Python
- Go
curl "https://api.basistheory.com" \
-H "BT-API-KEY: <API_KEY>" \
-H "BT-TRACE-ID: aa5d3379-6385-4ef4-9fdb-ca1341572153"
await client.tenants.self.get({
correlationId: randomUUID()
});
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",
}
);
using BasisTheory.Client;
// Currently, a new client will be required for each
// request to set unique correlation_ids
var client = new BasisTheory(
apiKey: "<API_KEY>",
correlationId: Guid.NewGuid().ToString()
);
from basis_theory import BasisTheory
# Currently, a new client will be required for each
# request to set unique correlation_ids
client = BasisTheory(
correlation_id="<CORRELATION_ID>",
api_key="<API_KEY>",
)
client.tenants.self_.get()
response, _ := client.Tenants.Self.Get(
context.TODO(),
option.WithCorrelationID(StringPtr(uuid.NewString())),
)