Create profile
curl --request POST \
--url https://fit.kleep.ai/v1/profiles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Kleep-Retailer: <kleep-retailer>' \
--data '
{
"measurements": {
"gender": "female",
"age": 34,
"height_cm": 168,
"weight_kg": 61,
"body_shape": {
"stomach": "medium",
"hips": "wide"
}
},
"customer_id": "cust_88213"
}
'import requests
url = "https://fit.kleep.ai/v1/profiles"
payload = {
"measurements": {
"gender": "female",
"age": 34,
"height_cm": 168,
"weight_kg": 61,
"body_shape": {
"stomach": "medium",
"hips": "wide"
}
},
"customer_id": "cust_88213"
}
headers = {
"Kleep-Retailer": "<kleep-retailer>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Kleep-Retailer': '<kleep-retailer>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
measurements: {
gender: 'female',
age: 34,
height_cm: 168,
weight_kg: 61,
body_shape: {stomach: 'medium', hips: 'wide'}
},
customer_id: 'cust_88213'
})
};
fetch('https://fit.kleep.ai/v1/profiles', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://fit.kleep.ai/v1/profiles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'measurements' => [
'gender' => 'female',
'age' => 34,
'height_cm' => 168,
'weight_kg' => 61,
'body_shape' => [
'stomach' => 'medium',
'hips' => 'wide'
]
],
'customer_id' => 'cust_88213'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Kleep-Retailer: <kleep-retailer>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://fit.kleep.ai/v1/profiles"
payload := strings.NewReader("{\n \"measurements\": {\n \"gender\": \"female\",\n \"age\": 34,\n \"height_cm\": 168,\n \"weight_kg\": 61,\n \"body_shape\": {\n \"stomach\": \"medium\",\n \"hips\": \"wide\"\n }\n },\n \"customer_id\": \"cust_88213\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Kleep-Retailer", "<kleep-retailer>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://fit.kleep.ai/v1/profiles")
.header("Kleep-Retailer", "<kleep-retailer>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"measurements\": {\n \"gender\": \"female\",\n \"age\": 34,\n \"height_cm\": 168,\n \"weight_kg\": 61,\n \"body_shape\": {\n \"stomach\": \"medium\",\n \"hips\": \"wide\"\n }\n },\n \"customer_id\": \"cust_88213\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://fit.kleep.ai/v1/profiles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Kleep-Retailer"] = '<kleep-retailer>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"measurements\": {\n \"gender\": \"female\",\n \"age\": 34,\n \"height_cm\": 168,\n \"weight_kg\": 61,\n \"body_shape\": {\n \"stomach\": \"medium\",\n \"hips\": \"wide\"\n }\n },\n \"customer_id\": \"cust_88213\"\n}"
response = http.request(request)
puts response.read_body{
"profile_id": "<string>",
"measurements": {
"gender": "female",
"age": 34,
"height_cm": 168,
"weight_kg": 61,
"body_shape": {
"stomach": "medium",
"hips": "wide"
}
},
"customer_id": "<string>",
"source": "conversation",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "invalid_input",
"message": "age must be at most 100"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid API key"
}
}{
"error": {
"code": "retailer_not_enabled",
"message": "Retailer 9b1f… has not enabled this partner"
}
}{
"error": {
"code": "rate_limited",
"message": "Too many requests"
}
}Partner API reference
Create profile
Create a shopper profile without asking for a product, for example at the start of a styling conversation. Create recommendation also creates one when you send measurements.
POST
/
profiles
Create profile
curl --request POST \
--url https://fit.kleep.ai/v1/profiles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Kleep-Retailer: <kleep-retailer>' \
--data '
{
"measurements": {
"gender": "female",
"age": 34,
"height_cm": 168,
"weight_kg": 61,
"body_shape": {
"stomach": "medium",
"hips": "wide"
}
},
"customer_id": "cust_88213"
}
'import requests
url = "https://fit.kleep.ai/v1/profiles"
payload = {
"measurements": {
"gender": "female",
"age": 34,
"height_cm": 168,
"weight_kg": 61,
"body_shape": {
"stomach": "medium",
"hips": "wide"
}
},
"customer_id": "cust_88213"
}
headers = {
"Kleep-Retailer": "<kleep-retailer>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Kleep-Retailer': '<kleep-retailer>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
measurements: {
gender: 'female',
age: 34,
height_cm: 168,
weight_kg: 61,
body_shape: {stomach: 'medium', hips: 'wide'}
},
customer_id: 'cust_88213'
})
};
fetch('https://fit.kleep.ai/v1/profiles', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://fit.kleep.ai/v1/profiles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'measurements' => [
'gender' => 'female',
'age' => 34,
'height_cm' => 168,
'weight_kg' => 61,
'body_shape' => [
'stomach' => 'medium',
'hips' => 'wide'
]
],
'customer_id' => 'cust_88213'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Kleep-Retailer: <kleep-retailer>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://fit.kleep.ai/v1/profiles"
payload := strings.NewReader("{\n \"measurements\": {\n \"gender\": \"female\",\n \"age\": 34,\n \"height_cm\": 168,\n \"weight_kg\": 61,\n \"body_shape\": {\n \"stomach\": \"medium\",\n \"hips\": \"wide\"\n }\n },\n \"customer_id\": \"cust_88213\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Kleep-Retailer", "<kleep-retailer>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://fit.kleep.ai/v1/profiles")
.header("Kleep-Retailer", "<kleep-retailer>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"measurements\": {\n \"gender\": \"female\",\n \"age\": 34,\n \"height_cm\": 168,\n \"weight_kg\": 61,\n \"body_shape\": {\n \"stomach\": \"medium\",\n \"hips\": \"wide\"\n }\n },\n \"customer_id\": \"cust_88213\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://fit.kleep.ai/v1/profiles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Kleep-Retailer"] = '<kleep-retailer>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"measurements\": {\n \"gender\": \"female\",\n \"age\": 34,\n \"height_cm\": 168,\n \"weight_kg\": 61,\n \"body_shape\": {\n \"stomach\": \"medium\",\n \"hips\": \"wide\"\n }\n },\n \"customer_id\": \"cust_88213\"\n}"
response = http.request(request)
puts response.read_body{
"profile_id": "<string>",
"measurements": {
"gender": "female",
"age": 34,
"height_cm": 168,
"weight_kg": 61,
"body_shape": {
"stomach": "medium",
"hips": "wide"
}
},
"customer_id": "<string>",
"source": "conversation",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "invalid_input",
"message": "age must be at most 100"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid API key"
}
}{
"error": {
"code": "retailer_not_enabled",
"message": "Retailer 9b1f… has not enabled this partner"
}
}{
"error": {
"code": "rate_limited",
"message": "Too many requests"
}
}Authorizations
Your partner API key: kp_live_… in production, kp_test_… on the sandbox retailer.
Headers
The retailer's Kleep public_id. Every call is scoped to one retailer.
Any unique string. Retrying with the same key returns the same profile.
Body
application/json
Response
Created.
What the shopper tells you in the conversation. Convert imperial units before sending.
Show child attributes
Show child attributes
Example:
{
"gender": "female",
"age": 34,
"height_cm": 168,
"weight_kg": 61,
"body_shape": { "stomach": "medium", "hips": "wide" }
}
Where the profile was created.
Available options:
conversation, website_questionnaire, body_scan 