---
title: "Link web activity to user"
method: POST
path: "/link"
tags: ["Users"]
---

# Link web activity to user

`POST /link`

💡 You don't need to use this endpoint if you use our JavaScript snippet in your application.

This endpoint is used to link web activity to a user in your application. This will help you discover which channels and campaigns work best.

When our JavaScript snippet is embedded on your website, blog or landing pages, a cookie named "__journey" will be set.

This will only work if your website and application are under the same top level domain.

Website, blog or landing pages
* www.my-domain.tld
* blog.my-domain.tld
* landing-page.my-domain.tld

Application
* app.my-domain.tld

The cookie on my-domain.tld will also be send to your app domain.

You should call this endpoint after the user succesfully logged in (so that you know the user's ID). Use the value of the cookie as device ID.

## Request body

- object — Link web activity to user
  - `deviceId` string, non-empty-string, required
  - `identification` object, required — User identification requires a userId, email or both
    - `email` string, email — Email address of the user
    - `userId` string, user-id — Unique identifier for the user in your database

## Response `201`

Object was created

- object — The message specifies what is done
  - `meta` object, required
    - `requestId` string, required
    - `status` number, required
  - `message` string, required

## Other responses

- `400` — Bad request, some fields or parameters are incorrect
- `401` — No API Key was provided or the key is not authorised to perform the action
- `403` — The API Key provided is currently not enabled
- `429` — Too many API requests were send
- `500` — An unexpected error occurred

---

[API](https://skmtc.dev/journy/apis/developer-documentation.md) · [All operations](https://skmtc.dev/journy/apis/developer-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/journy/developer-documentation/revisions/2abe45a5c780/schema)
