> For the complete documentation index, see [llms.txt](https://fredhopper.gitbook.io/product-discovery/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fredhopper.gitbook.io/product-discovery/resources/archived-pages/the-tracking-api-and-js-library/api-technical-documentation.md).

# REST API Technical Documentation

Use direct calls to the API.

## Send activity

<mark style="color:green;">`POST`</mark> `https://collect-eu.attraqt.io/:trackerKey`

Send an activity to the API

#### Path Parameters

| Name       | Type   | Description                                       |
| ---------- | ------ | ------------------------------------------------- |
| trackerKey | string | Tracker key uniquely identifying the application. |

#### Request Body

| Name      | Type   | Description                                                                                                                    |
| --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------ |
| target    | object | The target of the action                                                                                                       |
| action    | string | The user's action on the website                                                                                               |
| user      | object | User object (traits, segments and identities)                                                                                  |
| sourceId  | string | If the action is on a search result or a recommendation, then send the sourceId - responseId in FHR or recommendationId in XO. |
| metadata  | object | All additional contextual data on the performed action                                                                         |
| segments  | array  | List of segments, usually for describing the client                                                                            |
| timestamp | string | Timestamp in ISO format                                                                                                        |

{% tabs %}
{% tab title="201 Activity successfully sent." %}

```
{"profiles":{}}
```

{% endtab %}

{% tab title="401 Failed to validate tracker key" %}

```
{ "error": "Unauthorized", "message": "Unknown tracker key" }
```

{% endtab %}

{% tab title="422 Failed to validate activity." %}

```
{ "error": "Unprocessable Entity", "message": "Tracker key not valid" }
```

{% endtab %}
{% endtabs %}

For an overview of the `Activity` object see:

For the `User` details, visit this link:

{% content-ref url="<https://github.com/Attraqt/product-discovery-documentation/blob/main/new-docs/Archive/the-tracking-api-and-js-library/broken-reference/README.md>" %}
<https://github.com/Attraqt/product-discovery-documentation/blob/main/new-docs/Archive/the-tracking-api-and-js-library/broken-reference/README.md>
{% endcontent-ref %}

`Users` must have a `sessionId` on their identities. This unique ID makes it possible to follow the visitors throughout their navigation if they are not connected.
