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

# Record a visit

> Record a storefront visit for attribution and analytics. At least one UTM parameter is required, and the endpoint is throttled. Returns the stored visit id and the session id used for touchpoint tracking.



## OpenAPI

````yaml /api-reference/openapi.json post /visits
openapi: 3.0.0
info:
  title: Marzipan API
  version: 1.0.0
servers:
  - url: https://api.marzipan.co/v1
security:
  - tenantAuth: []
tags:
  - name: Account
    description: >-
      Account management endpoints including registration, login, and user
      details
  - name: Carts
    description: Shopping cart management endpoints
  - name: Products
    description: Product catalog and search endpoints
  - name: Subscriptions
    description: Subscription management and renewal endpoints
  - name: CMS
    description: Content management system endpoints
  - name: Messaging
    description: Message and communication endpoints
  - name: Search
    description: Search functionality endpoints
  - name: Settings
    description: >-
      Storefront settings and market detection used to configure the web
      components and checkout.
  - name: Analytics
    description: Storefront visit and attribution tracking.
  - name: Rewards
    description: >-
      Loyalty and rewards programme endpoints for the authenticated customer,
      covering points balance, tier status, perks, exclusive products and
      transaction history.
  - name: Forms
    description: Render and submit dynamic storefront forms defined in the CMS.
  - name: Events
    description: >-
      Check event availability, browse occurrences and recurring dates, generate
      ticket QR codes, and manage event waitlists (join, leave, check status,
      and claim promoted spots).
paths:
  /visits:
    post:
      tags:
        - Analytics
      summary: Record a visit
      description: >-
        Record a storefront visit for attribution and analytics. At least one
        UTM parameter is required, and the endpoint is throttled. Returns the
        stored visit id and the session id used for touchpoint tracking.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                utmSource:
                  type: string
                  maxLength: 255
                  nullable: true
                utmMedium:
                  type: string
                  maxLength: 255
                  nullable: true
                utmCampaign:
                  type: string
                  maxLength: 255
                  nullable: true
                utmTerm:
                  type: string
                  maxLength: 255
                  nullable: true
                utmContent:
                  type: string
                  maxLength: 255
                  nullable: true
                landingPage:
                  type: string
                  maxLength: 2048
                  nullable: true
                referrer:
                  type: string
                  maxLength: 2048
                  nullable: true
                sessionId:
                  type: string
                  maxLength: 64
                  nullable: true
                  description: >-
                    Existing session id to continue touchpoint tracking; a new
                    one is generated when omitted.
            example:
              utmSource: instagram
              utmMedium: social
              utmCampaign: summer-sale
              landingPage: https://shop.marzipan.co/collections/cakes
              referrer: https://instagram.com
              sessionId: s_a1b2c3d4e5f6
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Visit'
              example:
                id: 7f3d9c1a-2b4e-4c6d-8e0f-1a2b3c4d5e6f
                sessionId: s_a1b2c3d4e5f6
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
components:
  schemas:
    Visit:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The stored visit id.
        sessionId:
          type: string
          description: >-
            Session id used for touchpoint tracking; echoes the supplied value
            or a newly generated one.
    ValidationError:
      type: object
      properties:
        message:
          type: string
          description: Validation error message
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          description: Field-specific validation errors
      required:
        - message
        - errors
  securitySchemes:
    tenantAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your API token.
      bearerFormat: JWT

````