# Get LTV score by ID

## GetLTVScoreByID Endpoint Documentation

This endpoint provides access to the LTV (Lifetime Value) score related to a specific user ID in your application. You can access this data by providing either the `idfa` or `idfv`.

### **Endpoint**

`https://0d634nkn4a.execute-api.us-east-2.amazonaws.com/development/getltvscorebyid`

### **Request Type**

`POST`

### **Headers**

`x-api-key`: Your unique API key. Please contact the Datonomy team to request this key.

`Content-Type`: This should be set as `application/json`.

### **Body**

The request body should be a JSON object containing one of the following properties:

`idfa`: The ID for Advertisers

`idfv`: The ID for Vendors

Example of a valid request body:

```json
{
    "idfv": "5193FAB5-EDE4-43E0-BA36-10DF0BB0ECB0"
}
```

### **Curl Command Example**

```sh
curl --location 'https://0d634nkn4a.execute-api.us-east-2.amazonaws.com/development/getltvscorebyid' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "idfv": "YOUR_IDFV"
}
'
```

Replace `YOUR_API_KEY` and `YOUR_IDFV` with your actual API key and the ID for Vendors respectively.

Please remember to keep your `x-api-key` confidential to prevent unauthorized access to the endpoint.

For any further questions, feel free to reach out to the Datonomy team.

### **Response**

The response from the `getltvscorebyid` endpoint is a JSON object. If the request is successful, you will receive a response containing the following property:

* `ltvScore`: The Lifetime Value (LTV) score related to the provided `idfa` or `idfv`. This is a numeric value.

#### Response Status Codes

The service may return one of the following status codes:

* 200: Success. The ltvScore has been returned in the response body.
* 400: Bad Request. The server could not understand the request due to invalid syntax.
* 403: Forbidden. The server understood the request but refuses to authorize it. Typically due to an invalid x-api-key.
* 404: Not Found. The server could not find the requested idfa or idfv.
* 500: Internal Server Error. The server encountered an unexpected condition which prevented it from fulfilling the request.

#### Successful Response Example

A successful response will return the ltvScore in JSON format like this:

```json
{
    "ltvScore": 9
}
```

In this example, the ltvScore for the provided idfa or idfv is 9.

#### Error Response Example

An error response will look like this:

```json
{
    "message": "Error description"
}
```

The `message` attribute will contain a description of the error that occurred. This can be useful for debugging purposes.

For further information or clarification, please contact the Datonomy team.
