> For the complete documentation index, see [llms.txt](https://docs.empe.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.empe.io/develop/wallet-server/credential-management.md).

# Credential Management

Wallet Server stores Verifiable Credentials (VCs) per user. You can import, list, fetch, and delete credentials.

## Endpoints

* POST `/credentials`
  * Imports a credential JSON. Validates schema, proof, and (by default) that the subject matches the holder DID.
  * Body:
    * `credential`: VC JSON
    * `allowForeignSubject` (boolean, default `false`): if `true`, skip subject‑equals‑holder check
* GET `/credentials`
  * Returns `{ count, credentials }` with optional filters:
    * `network`: `mainnet` | `testnet` (derived from VC id DID)
    * `type`: VC type
    * `status`: W3C StatusPurpose
    * `issuedAt`: ISO date
    * `version`: 1 | 2
* GET `/credentials/:id`
  * Returns a specific credential by id.
* DELETE `/credentials`
  * Deletes all credentials for the authenticated user.
* DELETE `/credentials/:id`
  * Deletes a specific credential by id.

## Examples

Import a credential:

```
curl -X POST http://localhost:3000/credentials \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{"credential": { ... }, "allowForeignSubject": false}'
```

List testnet credentials of a given type:

```
curl -H 'Authorization: Bearer <token>' \
  'http://localhost:3000/credentials?network=testnet&type=UniversityDegreeCredential'
```

Fetch by id:

```
curl -H 'Authorization: Bearer <token>' http://localhost:3000/credentials/<vc-id>
```

Delete all:

```
curl -X DELETE -H 'Authorization: Bearer <token>' http://localhost:3000/credentials
```

Delete by id:

```
curl -X DELETE -H 'Authorization: Bearer <token>' http://localhost:3000/credentials/<vc-id>
```

## Validation Rules (high level)

* Credential must have a recipient (holder)
* Unless `allowForeignSubject=true`, `credentialSubject.id` must equal holder DID
* Credential must have a `credentialSchema`
* Proof verification and schema validation must pass


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.empe.io/develop/wallet-server/credential-management.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
