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

# Replace the full spending alert configuration

> Replace thresholds, spikeAlerts and capEmailEnabled together. Keep stable rule IDs when editing. Does not change tariffs, recipient or spending cap and does not send a test email.



## OpenAPI

````yaml /openapi/deepface.openapi.yaml patch /api/billing/spending-alerts
openapi: 3.1.0
info:
  title: deepface.dev API
  version: v1
  summary: Managed API for face verification, embeddings, and vector comparison.
  description: >
    Canonical OpenAPI contract for the public deepface.dev gateway. This covers
    the public surface: health, readiness, capabilities, verify, represent, and
    compare. Account spending-alert operations use the per-path www.deepface.dev
    server. After the coordinated gateway release, anonymous accounts are
    limited to 2 requests/minute across Machines, one active inference and no
    waiting queue. Full account rate tiers are 15 requests/minute by default, 30
    with positive paid wallet funding, and 60/100/200/300 strictly above
    $10/$20/$50/$100 lifetime USD wallet funding. Enterprise accounts receive
    300. Only verified live non-test credited top-ups count. Counters are per
    gateway process unless Redis is shared. Paid prepaid wallets with active
    auto-topup and a valid saved card receive up to 20 percent off the starting
    rate. Image calls start at USD 2 per 1,000, including photo-to-vector
    checks; vector-only requests start at USD 0.20 per 1,000 pairs. Volume
    discounts approach final floors of USD 1 and USD 0.10 per 1,000
    respectively. Priority processing is twice the discounted rate.
  license:
    name: Proprietary
    url: https://deepface.dev/terms
servers:
  - url: https://api.deepface.dev
    description: Production gateway
security:
  - BearerAuth: []
  - ApiKeyHeader: []
tags:
  - name: Service
    description: Read-only service metadata and health routes.
  - name: Compute
    description: Authenticated face verification and vector-comparison endpoints.
  - name: Account
    description: Account settings on the website origin.
paths:
  /api/billing/spending-alerts:
    servers:
      - url: https://www.deepface.dev
        description: Account API (separate from the compute gateway)
    patch:
      tags:
        - Account
      summary: Replace the full spending alert configuration
      description: >-
        Replace thresholds, spikeAlerts and capEmailEnabled together. Keep
        stable rule IDs when editing. Does not change tariffs, recipient or
        spending cap and does not send a test email.
      operationId: updateSpendingAlerts
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SpendingAlertSettings'
      responses:
        '200':
          description: Private account settings and charged-usage snapshot
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SpendingAlertSnapshot'
        '400':
          description: Invalid JSON or settings; nothing saved
        '401':
          description: Missing, invalid, revoked or inactive-account credentials
        '413':
          description: Settings body exceeds 16 KiB
        '500':
          description: Save failed
        '503':
          description: Snapshot unavailable
components:
  schemas:
    SpendingAlertSettings:
      type: object
      properties:
        thresholds:
          type: array
          maxItems: 3
          items:
            type: object
            additionalProperties: false
            properties:
              id:
                type: string
                pattern: ^[a-zA-Z0-9_-]{1,64}$
              enabled:
                type: boolean
              amountCents:
                type: integer
                minimum: 1
                maximum: 1000000000
              period:
                type: string
                enum:
                  - daily
                  - monthly
            required:
              - id
              - enabled
              - amountCents
              - period
        spikeAlerts:
          type: array
          maxItems: 3
          items:
            type: object
            additionalProperties: false
            properties:
              id:
                type: string
                pattern: ^[a-zA-Z0-9_-]{1,64}$
              enabled:
                type: boolean
              mode:
                type: string
                enum:
                  - days
                  - weekdays
                  - same_weekday
                  - weeks
                  - months
              samples:
                type: integer
                minimum: 1
                maximum: 90
                description: >-
                  Previous completed periods: at most 12 months, 52 weeks or
                  matching weekdays, or 90 days/weekdays.
              percentAbove:
                type: number
                minimum: 0
                maximum: 10000
              minimumSpendCents:
                type: integer
                minimum: 1
                maximum: 1000000000
            required:
              - id
              - enabled
              - mode
              - samples
              - percentAbove
              - minimumSpendCents
            allOf:
              - if:
                  properties:
                    mode:
                      const: months
                then:
                  properties:
                    samples:
                      maximum: 12
              - if:
                  properties:
                    mode:
                      enum:
                        - weeks
                        - same_weekday
                then:
                  properties:
                    samples:
                      maximum: 52
        capEmailEnabled:
          type: boolean
          description: >-
            Email when the effective monthly spending cap is hit or blocks a
            request; does not change the cap.
      required:
        - thresholds
        - spikeAlerts
        - capEmailEnabled
      additionalProperties: false
    SpendingAlertSnapshot:
      type: object
      required:
        - settings
        - timezone
        - spikeEvaluations
      properties:
        settings:
          $ref: '#/components/schemas/SpendingAlertSettings'
        timezone:
          type: string
        today:
          type: string
          format: date
        monthStart:
          type: string
          format: date
        todayMicrousd:
          type: number
        monthMicrousd:
          type: number
        monthComplete:
          type: boolean
        capMicrousd:
          type:
            - number
            - 'null'
        spikeEvaluations:
          type: array
          items:
            type: object
            properties:
              ruleId:
                type: string
              baselineReady:
                type: boolean
              baselineMicrousd:
                type: number
              averageAmountMicrousd:
                type: number
              averagePeriodStart:
                type: string
                format: date
              averagePeriodUnit:
                type: string
                enum:
                  - day
                  - week
                  - month
            additionalProperties: true
      additionalProperties: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: Use your API key as a bearer token.
    ApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: Alternative header for API key authentication.

````

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