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

# Create recommendation

> The size for one shopper and one product, in one call. Send the measurements collected in the conversation or a stored `profile_id`. When answers are missing, the call returns `422 missing_inputs` with the questions to ask: ask them, then call again.



## OpenAPI

````yaml /partners/openapi.json post /recommendations
openapi: 3.0.3
info:
  title: Kleep Partner API
  version: 1.0.0
  description: >-
    Size recommendations for conversational agents: customer-service agents, AI
    shopping assistants and AI agents, on behalf of Kleep retailers.
servers:
  - url: https://fit.kleep.ai/v1
    description: Production
security:
  - bearerAuth: []
paths:
  /recommendations:
    post:
      summary: Create recommendation
      description: >-
        The size for one shopper and one product, in one call. Send the
        measurements collected in the conversation or a stored `profile_id`.
        When answers are missing, the call returns `422 missing_inputs` with the
        questions to ask: ask them, then call again.
      operationId: createRecommendation
      parameters:
        - name: Kleep-Retailer
          in: header
          required: true
          schema:
            type: string
            format: uuid
          description: >-
            The retailer's Kleep `public_id`. Every call is scoped to one
            retailer.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RecommendationRequest'
            example:
              product_id: JEAN-0142
              shopper:
                measurements:
                  gender: female
                  age: 34
                  height_cm: 168
                  weight_kg: 61
                  body_shape:
                    stomach: medium
                    hips: wide
              locale: en-GB
              market: GB
              conversation_id: conv_5521
      responses:
        '200':
          description: The recommendation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Recommendation'
        '400':
          description: A field is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: invalid_input
                  message: height_cm must be at least 120
                  details:
                    field: shopper.measurements.height_cm
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: unauthorized
                  message: Invalid API key
        '403':
          description: This retailer has not enabled your integration.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: retailer_not_enabled
                  message: Retailer 9b1f… has not enabled this partner
        '404':
          description: Unknown product or profile.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: product_not_found
                  message: No product JEAN-9999 for this retailer
        '422':
          description: >-
            Answers are missing, or the product can't be sized
            (`product_not_supported`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: missing_inputs
                  message: Height and weight are needed
                  missing:
                    - height_cm
                    - weight_kg
                  questions:
                    - id: height_cm
                      required: true
                      type: number
                      unit: cm
                      min: 120
                      max: 230
                      prompt: How tall are you?
                    - id: weight_kg
                      required: true
                      type: number
                      unit: kg
                      min: 20
                      max: 250
                      prompt: How much do you weigh?
        '429':
          description: >-
            Rate limit reached. Retry after the number of seconds in
            `Retry-After`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: rate_limited
                  message: Too many requests
components:
  schemas:
    RecommendationRequest:
      type: object
      required:
        - product_id
        - shopper
      properties:
        product_id:
          type: string
          description: The retailer's product ID, as in its catalog.
          example: JEAN-0142
        shopper:
          $ref: '#/components/schemas/Shopper'
        fit_preference:
          type: string
          enum:
            - fitted
            - regular
            - loose
          default: regular
          description: Only when the shopper says how they like to wear it.
        locale:
          type: string
          description: BCP 47 language tag for `summary`, prompts and size labels.
          default: en
          example: fr-FR
        market:
          type: string
          description: >-
            ISO 3166-1 alpha-2 country of the shopper. Selects the market's size
            labels.
          example: FR
        conversation_id:
          type: string
          description: >-
            Your conversation or ticket ID. Lets Kleep attribute later orders to
            the chat.
          example: conv_5521
    Recommendation:
      type: object
      required:
        - recommendation_id
        - profile_id
        - product_id
        - size
        - summary
      properties:
        recommendation_id:
          type: string
          description: Identifies this recommendation, for feedback and attribution.
        profile_id:
          type: string
          description: >-
            The shopper's Kleep profile. Store it with your conversation or
            customer record and send it next time instead of asking again.
        product_id:
          type: string
        size:
          $ref: '#/components/schemas/Size'
        alternatives:
          type: array
          description: >-
            Neighbouring sizes that can also fit, at most one smaller and one
            larger.
          items:
            allOf:
              - $ref: '#/components/schemas/Size'
              - type: object
                properties:
                  direction:
                    type: string
                    enum:
                      - smaller
                      - larger
                  reason:
                    type: string
                    description: When to pick it, ready to say.
        fit:
          type: array
          description: >-
            How the recommended size fits, per body zone of the product's size
            chart.
          items:
            type: object
            properties:
              zone:
                type: string
                example: waist
                description: For example `chest`, `waist`, `hips`, `length`.
              fit:
                type: string
                enum:
                  - very_tight
                  - slightly_tight
                  - just_right
                  - slightly_loose
                  - very_loose
        product_fit:
          $ref: '#/components/schemas/ProductFit'
        summary:
          type: string
          description: >-
            The recommendation as one or two ready-to-say sentences, in the
            requested locale.
      example:
        recommendation_id: rec_7Hq2mV9xKp
        profile_id: prf_3Nf8sLw1Qz
        product_id: JEAN-0142
        size:
          label: M
          variant_id: JEAN-0142-M
          available: true
        alternatives:
          - label: L
            variant_id: JEAN-0142-L
            direction: larger
            available: true
            reason: For a looser fit
        fit:
          - zone: waist
            fit: just_right
          - zone: hips
            fit: slightly_tight
        product_fit:
          tendency: runs_small
          score: -0.4
        summary: >-
          I'd recommend size M. It should feel slightly snug at the hips; take
          an L if you prefer a looser fit.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - unauthorized
                - retailer_not_enabled
                - invalid_input
                - missing_inputs
                - product_not_found
                - product_not_supported
                - profile_not_found
                - recommendation_not_found
                - rate_limited
                - internal_error
              description: >-
                Stable, machine-readable error code. Branch on this, not on
                `message`.
            message:
              type: string
              description: >-
                Human-readable explanation, in English. Not meant to be shown to
                shoppers.
            missing:
              type: array
              items:
                type: string
              description: '`missing_inputs` only: the ids of the answers still needed.'
            questions:
              type: array
              items:
                $ref: '#/components/schemas/Question'
              description: >-
                `missing_inputs` only: the questions to ask for the missing
                answers, localized.
            details:
              type: object
              additionalProperties: true
              description: '`invalid_input` only: the offending fields.'
    Shopper:
      type: object
      description: >-
        Who the recommendation is for. Send a `profile_id` you stored, or the
        `measurements` collected in the conversation, or both (the measurements
        then update the profile).
      properties:
        profile_id:
          type: string
          description: A Kleep profile returned by a previous call or by a profile lookup.
          example: prf_3Nf8sLw1Qz
        measurements:
          $ref: '#/components/schemas/Measurements'
        customer_id:
          type: string
          description: >-
            The retailer's own customer ID, when the shopper is identified.
            Links the profile to the retailer's customer so the website and
            other channels reuse it.
          example: cust_88213
    Size:
      type: object
      required:
        - label
        - variant_id
      properties:
        label:
          type: string
          description: >-
            Size label as the retailer displays it in this market, for example
            `M`, `38` or `32 Long`.
        variant_id:
          type: string
          description: >-
            The retailer's variant ID for this size, as in its catalog: use it
            to add to cart.
        available:
          type: boolean
          description: '`true` when the variant is in stock.'
    ProductFit:
      type: object
      nullable: true
      description: >-
        How the product fits compared to its size chart, from Kleep's purchase
        and return data. `null` when there isn't enough data.
      properties:
        tendency:
          type: string
          enum:
            - runs_very_small
            - runs_small
            - true_to_size
            - runs_large
            - runs_very_large
        score:
          type: number
          minimum: -1
          maximum: 1
          description: >-
            Same signal as a number: -1 runs very small, 0 true to size, 1 runs
            very large.
        summary:
          type: string
          description: Ready-to-say sentence in the requested locale.
    Question:
      type: object
      required:
        - id
        - required
        - type
        - prompt
      properties:
        id:
          type: string
          description: >-
            Path of the answer in `measurements`, for example `height_cm` or
            `body_shape.hips`.
        required:
          type: boolean
        type:
          type: string
          enum:
            - choice
            - number
            - integer
            - text
        prompt:
          type: string
          description: >-
            Ready-to-ask wording in the requested locale. Rephrase freely to
            match your bot's tone.
        unit:
          type: string
          enum:
            - cm
            - kg
        min:
          type: number
        max:
          type: number
        default:
          type: string
          description: Value Kleep assumes when an optional question is skipped.
        options:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
              label:
                type: string
    Measurements:
      type: object
      description: >-
        What the shopper tells you in the conversation. Convert imperial units
        before sending.
      properties:
        gender:
          type: string
          enum:
            - female
            - male
          description: >-
            Women's or men's sizes: the cut the shopper wants, not a personal
            identity question.
        age:
          type: integer
          minimum: 12
          maximum: 100
        height_cm:
          type: number
          minimum: 120
          maximum: 230
        weight_kg:
          type: number
          minimum: 20
          maximum: 250
        body_shape:
          $ref: '#/components/schemas/BodyShape'
        bra:
          type: object
          description: Women's sizes, optional. Required only for lingerie.
          properties:
            band:
              type: string
              example: '85'
            cup:
              type: string
              example: B
            system:
              type: string
              enum:
                - EU
                - FR
                - UK
                - US
              default: EU
      example:
        gender: female
        age: 34
        height_cm: 168
        weight_kg: 61
        body_shape:
          stomach: medium
          hips: wide
    BodyShape:
      type: object
      description: >-
        Optional body-shape answers. Each one improves accuracy; skip any the
        shopper doesn't want to answer.
      properties:
        stomach:
          type: string
          enum:
            - flat
            - medium
            - round
        hips:
          type: string
          enum:
            - narrow
            - medium
            - wide
          description: Women's sizes.
        torso:
          type: string
          enum:
            - slim
            - medium
            - muscular
          description: Men's sizes.
        thighs:
          type: string
          enum:
            - thin
            - medium
            - large
          description: Men's sizes.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your partner API key: `kp_live_…` in production, `kp_test_…` on the
        sandbox retailer.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.