> ## Documentation Index
> Fetch the complete documentation index at: https://docs.winningvariant.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Identifier Linking via API

> Linking identifiers via the RESTful API.

## Overview

Use the API described below to link two different identifiers from within your application.

The hostname for the API can be retrieved by clicking the App from within Snowflake: Data Products > Apps > Winning Variant Experimentation. The hostname for "Variant API" is the one you'll use.

## Identifier Link

`POST /id-link`

Use this endpoint to link two different identifiers.

### **Request Body**

The request accepts a JSON-formatted body with the following parameters:

| **Parameter** | **Type**      | **Required** | **Description**                                                 |
| :------------ | :------------ | :----------- | :-------------------------------------------------------------- |
| `identifiers` | `Identifer[]` | Yes          | List of identifiers to link together. Length must be exactly 2. |

`Identifier`

The identifer object in the body includes the following properties:

| **Parameter**  | **Types** | **Required** | **Description**                                      |
| -------------- | --------- | ------------ | ---------------------------------------------------- |
| `subject_type` | `string`  | Yes          | The subject type defined in your app configuration.  |
| `subject_id`   | `string`  | Yes          | ID for the subject that you want to link another to. |

### **Response**

Upon success, returns a `200` status code with response `{ "success": true }`.

### Examples

**Link an anonymous ID to a customer ID**

In this example, we link an ID for subject type `ANONYMOUS_ID` to an ID for subject type `CUSTOMER_ID` (both subject types already exist).

```
POST /id-link
Content-type: application/json
Accept: application/json
{
  "identifiers": [{
    "subject_type": "CUSTOMER_ID",
    "subject_id": "ce0fb767-27de-477d-bebc-064dd724bb0b"
  }, {
    "subject_type": "ANONYMOUS_ID",
    "subject_id": "58865777-783b-4f41-9be4-a09afbaf187b"
  }]
}

Response:
{
  "success": true
}
```

## Public Access

To learn how you can access these services from outside of Snowflake, [read more here](https://docs.winningvariant.com/assignments/api#public-access).
