---
title: "Query Resources by Metadata"
description: "Use /metadata/query to find child resources (keys, credentials, DIDs, etc.) that match specific metadata constraints. Constraints follow the Presentation Definition format: each field lists a JSON path and an optional…"
stack: "Enterprise Stack (commercial) — version 0.21.0"
stack_version: "0.21.0"
stack_comparison: https://docs.walt.id/community-vs-enterprise.md
canonical_url: https://docs.walt.id/enterprise-stack/administration/services/metadata/query
generated: 2026-07-08
---
# Query Resources by Metadata

Use `/metadata/query` to find child resources (keys, credentials, DIDs, etc.) that match specific metadata constraints. Constraints follow the Presentation Definition format: each field lists a JSON path and an optional JSON Schema filter.

## Query metadata (Credential Store example)

**Option: CURL**

Endpoint: `/v1/{target}/credential-store-service-api/credentials/metadata/query` | [API Reference](https://enterprise.sandbox.walt.id/swagger/index.html#/Credential%20Store/post_v1__target__credential_store_service_api_metadata_query)

**Example Request**

```bash
curl -X 'POST' \
  'https://{orgHost}.enterprise-sandbox.waltid.dev/v1/{target}/credential-store-service-api/credentials/metadata/query' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer {yourToken}' \
  -H 'Content-Type: application/json' \
  -d '[
    {
      "path": ["$.tags"],
      "filter": {
        "type": "array",
        "contains": {
          "const": "production"
        }
      }
    }
  ]'
```

**Path Parameters**

- `orgHost`: _String_ – Organization host alias. In sandbox, `test` resolves to `https://test.enterprise-sandbox.waltid.dev`.
- `target`: _resourceIdentifier_ – Credential Store service you want to search (`{organization}.{tenant}.{serviceId}`), e.g. `test.tenant1.credential-store-1`.

**Body Parameters**

- `constraints`: _Array_ – List of Presentation Definition `field` objects. Each object contains:
  - `path`: JSON path expressions to inspect (prefixed with `$`).
  - `filter`: Optional JSON Schema fragment used to match the metadata value.

**Example Response** `200 OK`

```json
{
  "test.tenant1.credential-store-1.credential-123": {
    "description": "Employee badge",
    "tags": ["production", "badge"]
  }
}
```

- Keys are resource targets; values are the matched metadata objects. Empty object indicates no matches.
