> For the complete documentation index, see [llms.txt](https://docs.hashkey.id/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hashkey.id/developers/guides/credential-api-rule.md).

# Credential API Rule

If you want invoke your own HTTP API to check whether a address is eligible dynamically, you need follow this guide.

## Method

Your API should use http **GET** method

## URL

URL for your API should contains user's 0x address. You could place it in URL or query parameters. And could with other static param like your rule ID. Here's some examples below:

* <https://example.com/api/eligible?address={address}>
* <https://example.com/api/eligible/{address}>
* <https://example.com/api/eligible?activity=demo\\&address={address}>
* <https://example.com/api/activities/demo/eligible/{address}>

## Request Headers / Body

Hashkey DID will send empty request body and no specific headers.

## Response Header

Your should set `Content-Type` to `application/json`, because of we only support JSON format by now. No other specific headers.

## Response Body

Using JSON format in response body, attributes definitions' below:

* code: integer, you should set it to 200 if API invoke is correct.
* msg: string, you should set it as error message when code is not 200. Otherwise "ok" is ok.
* data: boolean, true only when the address is eligible.

Example Eligible:

```json
{
	"code": 200,
	"msg": "ok",
	"data": true
}
```

Example Not Eligible

```json
{
	"code": 403,
	"msg": "The address is not eligible.",
	"data": false
}
```

## Whitelist

You need to make sure servers for Hashkey DID could access your API, so you could add below IPs to your whitelist.

* 54.254.70.197
* 13.215.165.253
* 18.140.251.108
* 18.138.89.198
* 13.228.194.226
* 18.136.155.107


---

# 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:

```
GET https://docs.hashkey.id/developers/guides/credential-api-rule.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
