> For the complete documentation index, see [llms.txt](https://dfend.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dfend.gitbook.io/documentation/developer-api/initial-test.md).

# Initial Test

## Prepare

### Sign up for a free DFend account

Sign up [here](https://dashboard.dfend.app/auth/register). You have 1,000 free requests per month. **No credit card required.**

{% hint style="info" %}
If you already have a DFend account, log in [here](https://dashboard.dfend.app/auth/login).
{% endhint %}

### Locate API keys

Follow [this link](https://dashboard.dfend.app/dashboard/setup/api-keys) to find your API keys.

### Open a terminal session

Find and open terminal (Mac) or Command Line (Windows) or the equivalent on your computer. We will be using **cURL** for this test, which normally comes preinstalled.

{% hint style="info" %}
You can also run an equivalent test using any HTTP request testing tool, such as Postman. However, you will need to adapt the commands to the tool's interface.
{% endhint %}

## Create a test Identity

Copy and paste the following multi-line command into your terminal, making sure to replace **SECRET\_API\_KEY** with your key:

`curl -X POST https://api.dfend.app/identity \`\
`-H 'Content-Type: application/json' \`\
`-H 'x-api-key: SECRET_API_KEY' \`\
`-d '{"userId":"test"}'`

After replacing the value, press **enter** to run the command. See the response log, and continue to the next step assuming there was no error.

{% hint style="warning" %}
If you encounter an error that hints at Identity, please ensure that the entire command was pasted.
{% endhint %}

## Send a Signal for your test Identity

### From an untrusted (browser) environment

Use the tool at <https://demo.dfend.app>. Since you already created your test Identity, ignore that section.

{% hint style="info" %}
The demo tool uses the DFend [JS SDK](/documentation/developer-api/js-sdk.md), which you can add to any website or app that runs in a JavaScript environment.
{% endhint %}

### From a trusted (server) environment

{% hint style="info" %}
You can run this test on your computer. However, do not share your secret API key with anyone.
{% endhint %}

#### Prerequisite

Find your **public IP address.** Run the following command:

`curl ifconfig.me`

This will log your public IP address. There may be an extra `%` character on the end. Ignore this character. Only use the numbers and dots.&#x20;

{% hint style="info" %}
On your computer, you can also find this by searching Google for "what is my IP address".
{% endhint %}

You will use your IP address in the next step.

#### Send a Signal

Similar to how you created an Identity, run this multi-line command from terminal, replacing **SECRET\_API\_KEY** with your key and **IP\_ADDRESS** with your IP address.

`curl -X POST https://api.dfend.app/signal \`\
`-H 'Content-Type: application/json' \`\
`-H 'x-api-key: SECRET_API_KEY' \`\
`-d '{"source":"Server","ip":"IP_ADDRESS","identifiers":{"userId":"test"}}'`

Enter your IP address between the quotes, preserving them.

## View in Dashboard

**Congratulations, you've finished the test!**

View the **Identity** you created [here](https://dashboard.dfend.app/dashboard/insights/identities).

View the **Signal** you sent [here](https://dashboard.dfend.app/dashboard/insights/signals).

## Further testing

If you would like to trigger an anomaly, switch to a VPN on a location far from where you were initially located. Send another signal using the tool at <https://demo.dfend.app> for the same test Identity. Then visit the Events page under the Insights submenu in Dashboard.


---

# 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://dfend.gitbook.io/documentation/developer-api/initial-test.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.
