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

# Save one pin set of a surface

> Saves one pin set of a surface: the body is the complete set for one (anchor_type, anchor_id, market_id), and the stored pins for that set are reconciled to it (added, moved, removed); an empty `pins` clears the set. Other sets are untouched. Side effect: queues a background recompute of the surface. Returns the saved set.



## OpenAPI

````yaml /api-reference/openapi/lite.json put /recommendations/surfaces/{surface_name}/pins
openapi: 3.1.0
info:
  title: Search & Merchandising API
  version: 1.0.0
  description: >-
    REST API behind Depict: Search & Merchandising, the native Shopify app:
    onboarding, collections, boost & bury, dashboards, A/B testing and
    multi-store management. Endpoints are served under the /api/lite prefix and
    are authenticated with the Shopify session token that App Bridge issues to
    the embedded app.
servers:
  - url: /api/lite
security:
  - ShopifySessionToken: []
paths:
  /recommendations/surfaces/{surface_name}/pins:
    put:
      summary: Save one pin set of a surface
      description: >-
        Saves one pin set of a surface: the body is the complete set for one
        (anchor_type, anchor_id, market_id), and the stored pins for that set
        are reconciled to it (added, moved, removed); an empty `pins` clears the
        set. Other sets are untouched. Side effect: queues a background
        recompute of the surface. Returns the saved set.
      operationId: recsSurfacePinsPut
      parameters:
        - schema:
            type: string
            pattern: ^[a-z0-9_-]+$
            description: The surface's URL-safe name.
          required: true
          description: The surface's URL-safe name.
          name: surface_name
          in: path
        - schema:
            type: string
            description: Lite merchant id, e.g. `shopify-<shop id>`.
          required: true
          description: Lite merchant id, e.g. `shopify-<shop id>`.
          name: merchant_id
          in: query
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RecommendationPinSetRequestSchema'
      responses:
        '200':
          description: The saved set.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecommendationPinSetSchema'
        '400':
          description: >-
            The request failed the schema, or the set does not fit the surface
            (its id or context).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
        '401':
          description: Not authenticated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
        '403':
          description: Authenticated, but this identity may not call the API.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
        '404':
          description: Merchant not found for this caller, or no such surface.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
        '415':
          description: Content-Type is not application/json.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
        '500':
          description: Internal error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
components:
  schemas:
    RecommendationPinSetRequestSchema:
      type: object
      properties:
        anchor_type:
          type: string
          description: >-
            `any` on an unanchored surface, `category` on a category surface,
            `lvl1` on a product surface.
        anchor_id:
          type:
            - string
            - 'null'
          minLength: 1
          maxLength: 256
          default: null
          description: >-
            The product or collection the set applies to; null = every anchor.
            Must be null for `any`.
        market_id:
          type:
            - string
            - 'null'
          minLength: 1
          maxLength: 256
          default: null
          description: The market the set applies to; null = every market.
        pins:
          type: array
          items:
            $ref: '#/components/schemas/RecommendationPinRequestSchema'
          maxItems: 100
        surface_id:
          type:
            - string
            - 'null'
          default: null
          description: >-
            Optional guard: when set, must equal the surface's id (400
            otherwise).
      required:
        - anchor_type
        - pins
      additionalProperties: false
      description: '`anchor_type` is one of any, category, lvl1, lvl2, lvl3.'
    RecommendationPinSetSchema:
      type: object
      properties:
        surface_id:
          type: string
        anchor_type:
          type: string
        anchor_id:
          type:
            - string
            - 'null'
        market_id:
          type:
            - string
            - 'null'
        pins:
          type: array
          items:
            type: object
            properties:
              pinned_id:
                type: string
              pinned_level:
                type: string
              position:
                type: integer
            required:
              - pinned_id
              - pinned_level
              - position
      required:
        - surface_id
        - anchor_type
        - anchor_id
        - market_id
        - pins
    Detail:
      type: object
      properties:
        detail:
          type: string
      required:
        - detail
      description: 'Every 4xx/5xx body: `{detail}`.'
    RecommendationPinRequestSchema:
      type: object
      properties:
        pinned_id:
          type: string
          minLength: 1
          maxLength: 256
          description: The pinned product's id.
        pinned_level:
          type: string
          enum:
            - lvl1
            - lvl2
            - lvl3
          description: >-
            lvl1 = product, lvl2 = product group, lvl3 = variant. Only lvl1 can
            be placed today.
        position:
          type: integer
          minimum: 0
          maximum: 2147483647
          description: 0-based slot; unique within the set.
      required:
        - pinned_id
        - pinned_level
        - position
      additionalProperties: false
  securitySchemes:
    ShopifySessionToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Shopify App Bridge session token of the embedded Depict: Search &
        Merchandising app. The shop in the token determines the merchant;
        merchant_id parameters must belong to that shop.

````