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

# Change the lifecycle windows

> Scope `customers:write`. Send any of `reorder_due_days`, `lapsed_days`, `dormant_days` (1 to 3650; reorder due cannot exceed lapsed).



## OpenAPI

````yaml /pharmacy-api/customers-openapi.yaml put /customers/settings
openapi: 3.1.0
info:
  title: Pharmacy Customers API
  version: 1.0.0
  description: >
    Connect your CRM (GoHighLevel and similar) to your pharmacy's customers:
    send a provider when your CRM marks it as converted,

    get webhooks when its orders ship or deliver and when it needs a reorder,
    has lapsed or (for a partner rep) has gone

    dormant, and export your providers.


    **Authentication.** `Authorization: Bearer vr_live_...`. A key belongs to
    your pharmacy and carries `customers:read`

    and/or `customers:write` (create it under **Settings → API keys**). Test
    keys (`vr_test_...`) can read; their writes are

    acknowledged with `sandbox: true` and change nothing. Your pharmacy must
    have customers enabled.


    **Ids.** A customer's `id` is its VitaRelay organization id. `external_id`
    is your CRM's own id for the provider (the

    GoHighLevel contact id); sending the same `external_id` again updates the
    provider and never creates a second one.


    **Webhooks.** Subscribe with `POST /customers/webhooks`. Each request is
    signed:

    `X-Webhook-Signature: sha256=<hex HMAC-SHA256 of the exact request body,
    keyed with your endpoint secret>`, with

    `X-Webhook-Event`, `X-Webhook-Delivery` and `X-Webhook-Timestamp` headers.
    Delivery is at least once with exponential

    backoff for about a day; deduplicate on `X-Webhook-Delivery`. Events:
    `order.shipped`, `order.delivered`,

    `order.cancelled`, `customer.reorder_due`, `customer.lapsed`,
    `partner.dormant`. Use `POST /customers/webhooks/ping`

    to send yourself a test event.


    **Lifecycle windows** are days since a customer's last order (reorder due
    30, lapsed 60, partner dormant 90 by default;

    change them with `PUT /customers/settings`). Each event fires once per last
    order. Connecting a CRM does not send events

    for customers that are already past a window: read their `lifecycle_status`
    from `GET /customers`.
servers:
  - url: https://vitarelay.com/api/public/v1
    description: Production
security:
  - bearer: []
paths:
  /customers/settings:
    put:
      summary: Change the lifecycle windows
      description: >-
        Scope `customers:write`. Send any of `reorder_due_days`, `lapsed_days`,
        `dormant_days` (1 to 3650; reorder due cannot exceed lapsed).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                reorder_due_days:
                  type: integer
                  minimum: 1
                  maximum: 3650
                lapsed_days:
                  type: integer
                  minimum: 1
                  maximum: 3650
                dormant_days:
                  type: integer
                  minimum: 1
                  maximum: 3650
      responses:
        '200':
          description: The windows now in force
        '422':
          description: Invalid (`validation_failed`)
components:
  securitySchemes:
    bearer:
      type: http
      scheme: bearer

````

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