<!--
{
  "availability" : [
    "iOS: 27.3.0 -",
    "iPadOS: 27.3.0 -",
    "macCatalyst: -",
    "macOS: 27.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "IdentityDocumentServices",
  "identifier" : "/documentation/IdentityDocumentServices/DigitalCredentialsQuery/ClaimsQuery/ClaimPath",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "IdentityDocumentServices"
    ],
    "preciseIdentifier" : "s:24IdentityDocumentServices23DigitalCredentialsQueryV06ClaimsF0V9ClaimPathV"
  },
  "title" : "DigitalCredentialsQuery.ClaimsQuery.ClaimPath"
}
-->

# DigitalCredentialsQuery.ClaimsQuery.ClaimPath

A path that identifies one or more claims within a credential.

```
struct ClaimPath
```

## Discussion

A credential stores its claims in a nested structure, so a name such as `city` isn’t enough to say which claim you mean. A claim path describes where the claim is by listing the steps to reach it, starting at the top level of the credential. Each step is a [`DigitalCredentialsQuery.ClaimsQuery.PathComponent`](/documentation/IdentityDocumentServices/DigitalCredentialsQuery/ClaimsQuery/PathComponent):

- [`DigitalCredentialsQuery.ClaimsQuery.PathComponent.key(_:)`](/documentation/IdentityDocumentServices/DigitalCredentialsQuery/ClaimsQuery/PathComponent/key(_:)) selects a key of an object.
- [`DigitalCredentialsQuery.ClaimsQuery.PathComponent.arrayElement(index:)`](/documentation/IdentityDocumentServices/DigitalCredentialsQuery/ClaimsQuery/PathComponent/arrayElement(index:)) selects the element at an index of an array.
- [`DigitalCredentialsQuery.ClaimsQuery.PathComponent.allArrayElements`](/documentation/IdentityDocumentServices/DigitalCredentialsQuery/ClaimsQuery/PathComponent/allArrayElements) selects every element of an array.

You pass a claim path to [`DigitalCredentialsQuery.ClaimsQuery`](/documentation/IdentityDocumentServices/DigitalCredentialsQuery/ClaimsQuery) to say which claim a request asks for. For example, a credential that contains the following data has a `city` claim inside an `address` object, and a `driving_privileges` array that contains one object for each vehicle category the person can drive:

```json
{
  "address": { "city": "Cupertino" },
  "driving_privileges": [
    { "vehicle_category_code": "B", "expiry_date": "2030-05-01" },
    { "vehicle_category_code": "A", "expiry_date": "2028-09-15" }
  ]
}
```

To request the city, create a path that selects `address` and then `city`, and use it in a claims query:

```swift
let cityPath = DigitalCredentialsQuery.ClaimsQuery.ClaimPath([
    .key("address"),
    .key("city")
])

let cityClaim = DigitalCredentialsQuery.ClaimsQuery(path: cityPath)
```

To request the expiration date of only the first driving privilege, select the `driving_privileges` array, then the element at index `0`, and then the `expiry_date` key:

```swift
let firstExpiryPath = DigitalCredentialsQuery.ClaimsQuery.ClaimPath([
    .key("driving_privileges"),
    .arrayElement(index: 0),
    .key("expiry_date")
])
```

To request the vehicle category code of every driving privilege, replace the second step with `.allArrayElements`:

```swift
let allCategoriesPath = DigitalCredentialsQuery.ClaimsQuery.ClaimPath([
    .key("driving_privileges"),
    .allArrayElements,
    .key("vehicle_category_code")
])
```

Since a path can select more than one claim, a single claims query can request several values at once.

## Topics

### Initializers

[`init([DigitalCredentialsQuery.ClaimsQuery.PathComponent])`](/documentation/IdentityDocumentServices/DigitalCredentialsQuery/ClaimsQuery/ClaimPath/init(_:))

Initializes a claim path.

[`init(arrayLiteral: DigitalCredentialsQuery.ClaimsQuery.PathComponent...)`](/documentation/IdentityDocumentServices/DigitalCredentialsQuery/ClaimsQuery/ClaimPath/init(arrayLiteral:))

Initialize a claims path pointer from a list of steps.

### Instance Properties

[`var components: [DigitalCredentialsQuery.ClaimsQuery.PathComponent]`](/documentation/IdentityDocumentServices/DigitalCredentialsQuery/ClaimsQuery/ClaimPath/components)

The steps that lead from the top level of a credential to the claim.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

[`ExpressibleByArrayLiteral`](/documentation/Swift/ExpressibleByArrayLiteral)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)