# Seal the signed-in shopper's body into a handle for the brand's server

```http
POST /v1/recommendation_handles
```

Source: https://docs.tryyoursize.com/api/reference/operations/createrecommendationhandle/

**Key:** publishable (`pk_test_…` / `pk_live_…`), from an origin registered for the key.

Called by the TryYourSize window (the SDK's invisible status frame), never by a brand's code: it needs the shopper's session (`Authorization: Bearer tys_sess_…`), which only our origin can read, plus the store's publishable key. The answer is an encrypted handle bound to the store, the mode and the shopper; the page passes it to the brand's server for POST /v1/recommendations. Nothing is stored: the handle itself is the sealed body, and neither the page nor the brand's server can read it. Expires after an hour.

## Authentication

Publishable key (`pk_test_…` / `pk_live_…`), from an origin registered for the key.

## Request body

`application/json`: `RecommendationHandleRequest`

The signed-in shopper's body as the TryYourSize window holds it (the same fields as POST /v1/tryon, without the product). Sent only by our window (status frame) or SDKs, never by a brand's page or server.

- `basics` (`BodyBasics`, required)
  - `sex` (`"female" | "male"`, required)
  - `age_years` (`integer`, required)
  - `height_mm` (`number (double)`, required)
  - `weight_kg` (`number (double)`, required)
- `measurements` (`Measurement[]`, optional, max 64 items)
  - `code` (`"neck_girth" | "shoulder_width" | "arm_length" | "armscye_girth" | "upper_arm_girth" | "wrist_girth" | "chest_girth" | "underbust_girth" | "bust_point_to_bust_point" | "shoulder_to_bust_point" | "back_length" | "waist_girth" | "front_waist_arc" | "high_hip_girth" | "abdomen_girth" | "hip_girth" | "front_hip_arc" | "thigh_girth" | "knee_girth" | "calf_girth" | "ankle_girth" | "inseam" | "outseam" | "crotch_length"`, required): Body measurement from set v1.
  - `value_mm` (`number (double)`, required): Measured value in millimetres.
  - `source` (`"tape_self" | "tape_helper" | "flat_garment" | "estimated"`, required)
- `body_state` (`number (double)[]`, required, max 64 items)

## Responses

### 201

Created (`RecommendationHandle`)

- `handle` (`string`, required): Starts with `tys_rh_`. Up to 4 KB.
- `expires_at` (`string (date-time)`, required)
- `mode` (`"test" | "live"`, required)

### 400

Invalid request (`Error`)

### 401

Missing or invalid credentials (`Error`)

### 403

Not allowed (`Error`)

### 422

The content is rejected (e.g. a body that cannot be rebuilt) (`Error`)

## Example

```bash
curl -X POST https://api.tryyoursize.com/v1/recommendation_handles \
  -H "Authorization: Bearer pk_test_…" \
  -H "TYS-Version: 2026-10-25" \
  -H "Content-Type: application/json" \
  -d @body.json
```
