> 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/https-api/signal.md).

# Signal

## **Endpoint**

#### \*\*<https://api.dfend.app**/signal>

Accepts requests from client or server environments (publishable or secret API key).

## Methods

### POST

Send a [Signal](/documentation/developer-api/types/signal.md). Some fields will only be accepted from a server environment.

{% hint style="info" %}
When using your secret API key, we will create Identities on the fly when we receive Signals with an unrecognized user ID.
{% endhint %}

#### Accepts (client environment)

`body`  <mark style="color:blue;">object</mark>  An object containing the following subset of [Signal](/documentation/developer-api/types/signal.md) fields that are suitable for sending from a client environment:

* `idempotencyKey`  <mark style="color:blue;">string optional</mark>  Prevent duplicate events by providing a unique key for this signal.
* `type`  <mark style="color:blue;">string optional</mark>  A custom string value representing the type of event.
* `source`  <mark style="color:blue;">enum</mark>  A string of value `'App' | 'Browser'`.
* `device`  <mark style="color:blue;">Device optional</mark>  An object of [Device](/documentation/developer-api/types/device.md) type.
* `identifiers`  <mark style="color:blue;">object</mark>  An object containing at least one of the following fields:
  * `userId`  <mark style="color:blue;">string</mark>  The user's primary key or unique ID in your system.
  * `identity`  <mark style="color:blue;">string</mark>  The `id` value of the user's [Identity](/documentation/developer-api/types/identity.md) in DFend.

#### Accepts (server environment)

`body`  <mark style="color:blue;">object</mark>  An object containing the following subset of [Signal](/documentation/developer-api/types/signal.md) fields that are suitable for sending from a server environment:

* `idempotencyKey`  <mark style="color:blue;">string optional</mark>  Prevent duplicate events by providing a unique key for this signal.
* `type`  <mark style="color:blue;">string optional</mark>  A custom string value representing the type of event.
* `source`  <mark style="color:blue;">enum</mark>  A string of value `'Server'`.
* `device`  <mark style="color:blue;">Device optional</mark>  An object of [Device](/documentation/developer-api/types/device.md) type.
* `identifiers`  <mark style="color:blue;">object</mark>  An object containing at least one primary and any secondary [Identifiers](/documentation/developer-api/types/identifiers.md).
* `ip`  <mark style="color:blue;">string</mark>  The user's client IP address from the original request you received.
* `userAgent`  <mark style="color:blue;">string optional</mark>  The user's client user-agent from the original request you received.
* `lat`  <mark style="color:blue;">number optional</mark>  The latitude coordinate, if you obtained it from the user's device.
* `lon`  <mark style="color:blue;">number optional</mark>  The longitude coordinate, if you obtained it from the user's device.
* `metadata`  <mark style="color:blue;">object optional</mark>  Custom metadata you wish to add to this Signal.
* `time`  <mark style="color:blue;">number optional</mark>  A Unix timestamp (ms) representing the original time of Signal event.

#### Returns

A JSON-encoded object containing the following fields:

* `started`  <mark style="color:blue;">number</mark>  A Unix timestamp (ms).
* `finished`  <mark style="color:blue;">number</mark>  A Unix timestamp (ms).
* `immediateResults`  <mark style="color:blue;">ImmediateResult\[]</mark>  An array of [ImmediateResult](/documentation/developer-api/types/immediateresult.md) objects.
