> For the complete documentation index, see [llms.txt](https://docs.teranode.group/tng-identity-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.teranode.group/tng-identity-documentation/did/bsv-did-universal-resolver/resolver-api.md).

# Resolver API

## Resolving a DID

Make a GET request to resolve a DID:

```
GET /1.0/identifiers/{did}
```

### **Example**

```bash
curl --location '{base url}/1.0/identifiers/did:bsv:b5c8407a46b32c4a59b3fe0693860588b00a0e7464d252cc6ac47089925c1e8c'
```

***

## Response Format

The service returns a [DID Resolution Result](https://www.w3.org/TR/did-core/#did-resolution) in JSON, which includes:

* **`didDocument`** – The resolved DID Document (or `null` if not applicable)
* **`didDocumentMetadata`** – Metadata about the DID Document (e.g., deactivation status, update times)
* **`didResolutionMetadata`** – Metadata about the resolution process (e.g., errors, method used)

***

## API Responses and Error codes

The resolver returns different HTTP status codes and response bodies based on the DID state:

| Scenario                 | HTTP Code                 | Response Description                                                  |
| ------------------------ | ------------------------- | --------------------------------------------------------------------- |
| **Active DID**           | 200 OK                    | Returns complete Document, Resolution Metadata, and Document Metadata |
| **Deactivated DID**      | 410 GONE                  | Document is null, metadata indicates deactivation                     |
| **Invalid DID URL**      | 400 BAD REQUEST           | Resolution metadata contains `invalidDidUrl` error                    |
| **Invalid DID**          | 400 BAD REQUEST           | Resolution metadata contains `invalidDid` error                       |
| **DID Not Found**        | 404 NOT FOUND             | Resolution metadata contains `notFound` error                         |
| **Method Not Supported** | 501 NOT IMPLEMENTED       | Resolution metadata contains `methodNotSupported` error               |
| **Invalid DID Data**     | 502 BAD GATEWAY           | Resolution metadata contains `invalidDidData` error                   |
| **Service Unavailable**  | 503 SERVICE UNAVAILABLE   | Resolution metadata contains `serviceUnavailable` error               |
| **Internal Error**       | 500 INTERNAL SERVER ERROR | Resolution metadata contains `internalError` error                    |

### Example Successful Response (Active DID)

```json
{
  "didDocument": { /* W3C-compliant DID Document */ },
  "didResolutionMetadata": {
        "contentType": {
            "mimeType": "application/ld+json",
            "charset": null
        }
    },
    "didDocumentMetadata": {
        "versionId": "96b77a29afa6155a6c8911d96fe20c3dc3c921762c2b9a864c73a258dff4fcd8",
        "method": {
            "transaction_id": "96b77a29afa6155a6c8911d96fe20c3dc3c921762c2b9a864c73a258dff4fcd8",
            "transaction_raw": " /* transaction in the raw hex format */",
            "block": {
                "blocktime": 1553501874,
                "confirmations": 322574,
                "hash": "testBlockHash",
                "blockheight": 575191
            }
        },
        "equivalentID": [],
        "created": "2025-08-12T14:21:12.232Z"
    }
}
```

### Example Error Response (DID Not Found)

```json
{
    "didDocument": null,
    "didResolutionMetadata": {
        "error": "notFound"
    },
    "didDocumentMetadata": {}
}
```

***


---

# 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.teranode.group/tng-identity-documentation/did/bsv-did-universal-resolver/resolver-api.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.
