---
title: "Tracking and grouping API calls using correlation IDs"
slug: "tracking-and-grouping-api-calls-using-correlation-ids"
updated: 2024-09-27T10:57:50Z
published: 2024-09-27T10:57:50Z
canonical: "support.lusid.com/tracking-and-grouping-api-calls-using-correlation-ids"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.lusid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tracking and grouping API calls using correlation IDs

You can specify a *correlation ID* when you make a set of LUSID API calls.

LUSID automatically records the correlation ID in the logs for those API calls, so you can use [Insights](/v1/docs/troubleshooting-a-failed-request-using-the-insights-service) (LUSID's built-in troubleshooting and audit application) to quickly track and group (that is, correlate) all the API calls made during a particular session. This might be useful to understand which call in a set was causing a performance lag, for example.

> **Note:** The correlation ID is set as a header in the HTTP request. The correlation ID value can consist of up to 256 case-insensitive alphanumeric characters, and also the following: `-` `_` `.` `#` `:`

## Using the REST API

To specify a correlation ID when calling the REST API directly, set a request header explicitly each time:

```bash
$ curl -X GET https://<your-domain>.lusid.com/api/api/instruments?limit=10 -H "CorrelationId: track-this-in-the-logs" -H "Authorization: Bearer <your-API-access-token>"
$ curl -X POST https://<your-domain>.lusid.com/api/api/instruments/$get?identifierType=Figi -H "CorrelationId: track-this-in-the-logs" -H "Authorization: Bearer <your-API-access-token>" -d "[ \"BBG000PG2GZ0\",]"
```

## Using the Python SDK

To specify a correlation ID when using the Python SDK, pass a suitable value in as a parameter when you create an `ApiClientFactory` object:

```python
import lusid

# Perform standard authentication using ApiClientFactory
secrets_file_path = "secrets.json"
config = ApiConfigurationLoader.load(secrets_file_path)
api_factory = lusid.utilities.ApiClientFactory(
    token=lusid.utilities.RefreshingToken(config),
    api_secrets_filename=secrets_file_path,
    correlation_id="track-this-in-the-logs"
)

# Build the instruments API
instruments_api = api_factory.build(lusid.api.InstrumentsApi)

# Call the ListInstruments API endpoint to list instruments
instruments_api.list_instruments(limit=10)

# Call the GetInstruments API endpoint to retrieve a particular instrument
instruments_api.get_instruments('Figi', ['BBG000PG2GZ0'])
```

## Tracking and grouping API calls using Insights

1. Sign in to the [LUSID web app](https://www.lusid.com/app/home) using the credentials of a LUSID administrator.
2. Navigate to the **Insights > Request Logs** dashboard.
3. Enter your correlation ID in the **Correlation Requests** column to correlate API calls (you may need to reorder columns in this dashboard to see them as they are here): ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/85f16ae1-d41e-4bad-ae07-55d91cd9c365.png)
