> For the complete documentation index, see [llms.txt](https://dev.guardian.hedera.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.guardian.hedera.com/static-spec-test/identity-and-access/trust-chains.md).

# Trust Chains

## Returns a list of all VP documents.

> Returns a list of all VP documents. Only users with the Standard Registry role are allowed to make the request.

```json
{"openapi":"3.0.0","info":{"title":"Guardian","version":"0.0.1"},"tags":[{"name":"trust-chains"}],"servers":[{"url":"/api/v1","description":"version 1.0"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"VpDocumentDTO":{"type":"object","properties":{"id":{"type":"string"},"policyId":{"type":"string"},"hash":{"type":"string"},"signature":{"type":"number"},"status":{"type":"string","enum":["NEW","ISSUE","REVOKE","SUSPEND","RESUME","FAILED"]},"tag":{"type":"string"},"type":{"type":"string"},"createDate":{"type":"string"},"updateDate":{"type":"string"},"owner":{"type":"string"},"document":{"$ref":"#/components/schemas/VpDTO"}},"required":["id","policyId","hash","signature","status","tag","type","createDate","updateDate","owner","document"]},"VpDTO":{"type":"object","properties":{"@context":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"type":{"type":"array","items":{"type":"string"}},"verifiableCredential":{"additionalProperties":true,"type":"array","items":{"type":"object"}},"proof":{"$ref":"#/components/schemas/ProofDTO"}},"required":["@context","id","type","verifiableCredential","proof"]},"ProofDTO":{"type":"object","properties":{"type":{"type":"string"},"created":{"type":"string"},"verificationMethod":{"type":"string"},"proofPurpose":{"type":"string"},"jws":{"type":"string"}},"required":["type","created","verificationMethod","proofPurpose","jws"]},"UnauthorizedErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]},"ForbiddenErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"},"error":{"type":"string"}},"required":["statusCode","message"]},"InternalServerErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]}}},"paths":{"/trust-chains":{"get":{"description":"Returns a list of all VP documents. Only users with the Standard Registry role are allowed to make the request.","operationId":"TrustChainsApi_getTrustChains","parameters":[{"name":"pageIndex","required":false,"in":"query","description":"The number of pages to skip before starting to collect the result set","schema":{"type":"number"}},{"name":"pageSize","required":false,"in":"query","description":"The numbers of items to return","schema":{"type":"number"}},{"name":"policyId","required":false,"in":"query","description":"Filter by policy database ID","schema":{"type":"string"}},{"name":"policyOwner","required":false,"in":"query","description":"Filter by policy owner DID","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful operation. Returns VP documents array and total count in X-Total-Count header.","headers":{"X-Total-Count":{"schema":{"type":"integer"},"description":"Total items in the collection."}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/VpDocumentDTO"}}}}},"401":{"description":"Unauthorized request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorDTO"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorDTO"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerErrorDTO"}}}}},"summary":"Returns a list of all VP documents.","tags":["trust-chains"]}}}}
```

## Builds and returns a trustchain, from the VP to the root VC document.

> Builds and returns a trustchain, from the VP to the root VC document. Only users with the Standard Registry role are allowed to make the request.

```json
{"openapi":"3.0.0","info":{"title":"Guardian","version":"0.0.1"},"tags":[{"name":"trust-chains"}],"servers":[{"url":"/api/v1","description":"version 1.0"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UnauthorizedErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]},"ForbiddenErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"},"error":{"type":"string"}},"required":["statusCode","message"]},"InternalServerErrorDTO":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["statusCode","message"]}}},"paths":{"/trust-chains/{hash}":{"get":{"description":"Builds and returns a trustchain, from the VP to the root VC document. Only users with the Standard Registry role are allowed to make the request.","operationId":"TrustChainsApi_getTrustChainByHash","parameters":[{"name":"hash","required":true,"in":"path","description":"VP document hash used to build the trust chain","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful operation. Returns the trust chain and user map.","content":{"application/json":{"schema":{"type":"object","properties":{"chain":{"type":"array","description":"Ordered array of documents forming the trust chain (from VP to root VC)","items":{"type":"object","properties":{"id":{"type":"string","description":"Document ID or DID"},"type":{"type":"string","description":"Document type (VC, VP, DID)"},"tag":{"type":"string","description":"Policy block tag"},"label":{"type":"string","description":"Human-readable label"},"schema":{"type":"string","description":"Schema identifier"},"owner":{"type":"string","description":"Document owner DID"},"document":{"type":"object","description":"Raw document content"}},"required":["id","type","tag","label","schema","owner","document"]}},"userMap":{"type":"array","description":"Mapping of DIDs to usernames for all users in the trust chain","items":{"type":"object","properties":{"did":{"type":"string","description":"User DID"},"username":{"type":"string","description":"Username"}},"required":["did","username"]}}},"required":["chain","userMap"]}}}},"401":{"description":"Unauthorized request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorDTO"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorDTO"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerErrorDTO"}}}}},"summary":"Builds and returns a trustchain, from the VP to the root VC document.","tags":["trust-chains"]}}}}
```
