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

# Welcome to the V4 APIs

The Future of Consent and Preference Management

Welcome to v4 OneTrust's most advanced Consent & Preference Management APIs. V4 is built from the ground up to empower developers, performance engineers, and integrators with the flexibility, clarity, and efficiency needed to deliver reliable and high-speed data subject interactions at scale.

## Benefits of switching to v4

V4 APIs are not just an iteration, they represent a fundamental architectural upgrade for the following reasons:

* **Purpose-Built endpoints:** Designed for specific use cases (e.g., retrieve data subject details, fetch purpose-level consent, etc.), resulting in less payload and better performance.
* **Modular and targeted:** Avoid bloated responses by selecting only what you need.
* **Improved filtering and pagination:** Enhanced support for pagination tokens and time-based filters for efficient data traversal.
* **Rate-Limit awareness and feedback:** Built-in response headers for smarter throttling and retry logic.
* **Granular consent handling:** V4 gives you detailed insight into each purpose, transaction, and preference at a per-data-subject level.
* **Consistency across services:** Adheres to modern OpenAPI 3.0.1 specifications with predictable response formats.

## V4 highlights

| V4 Endpoint                             | Use Case                                                                     |
| --------------------------------------- | ---------------------------------------------------------------------------- |
| /v4/datasubjects                        | Get a list of data subjects with updated metadata.                           |
| /v4/datasubjects/basic-details          | Fetch minimal data subject's information like identifiers and creation date. |
| /v4/datasubjects/details                | Retrieve complete data subject details including purposes and tokens.        |
| /v4/datasubjects/ds-profiles            | Get all purpose-level consent records for a data subject.                    |
| /v4/datasubjects/profiles               | Get all updated purpose records across all data subjects in a date range.    |
| /v4/datasubjects/profiles/{purposeGuid} | Retrieve purpose-specific consent for a data subject.                        |

## Sample request and response

### Get List of Data Subjects

**Request**

```curl
GET /v4/datasubjects?fromDate=2024-01-01T00:00:00&toDate=2024-01-15T00:00:00
Headers: { Authorization: Bearer <token> }
```

**Response**

```json
{
  "content": [
    {
      "identifier": "example@otprivacy.com",
      "createdDate": "2024-01-01T00:00:00Z",
      "lastUpdatedDate": "2024-01-10T10:45:00Z",
      "dataElements": [
        { "name": "Work Email", "value": "example@otprivacy.com" }
      ]
    }
  ]
}
```

### Get Data Subject Details

**Request**

```curl
GET /v4/datasubjects/details
Headers: { Authorization: Bearer <token>, identifier: example@otprivacy.com }
```

**Response**

```json
{
  "identifier": "example@otprivacy.com",
  "purposes": [
    {
      "name": "Marketing",
      "status": "ACTIVE",
      "consentDate": "2024-01-05T14:25:00Z"
    }
  ]
}
```

> 👍
>
> For more information, see [Introducing the V4 Data Subjects APIs](https://developer.onetrust.com/onetrust/reference/introducing-the-v4-data-subjects-apis) and [V1 to V4 Migration Guide](https://developer.onetrust.com/onetrust/reference/v1-to-v4-migration-guide).