Skip to main content

Overview

Update an existing restriction rule. Only specified fields are modified (partial update).

Endpoint

PATCH /api/v1/restrictions/:id
Authorization: ADMIN only

Path Parameters

id
string
required
UUID of the restriction rule to update

Request Body

Cannot modify: scope, entityId (bancaId/ventanaId/userId), loteriaId, or number after creation.To change these fields, delete and recreate the rule instead.

Updatable Fields

restrictionType
string
Rule type label
isActive
boolean
Enable or disable the rule without deleting it
isAutoDate
boolean
Enable/disable automatic date synchronization
number
string
Legacy single-number format only (batch updates not supported)To update multiple numbers, delete and recreate.
maxAmount
number
Maximum bet amount per jugada (must be positive)
maxTotal
number
Maximum total amount per ticket (must be positive)
baseAmount
number
Base amount for dynamic limits (≥ 0)
salesPercentage
number
Sales percentage for dynamic limits (0-100)
appliesToVendedor
boolean
Whether percentage applies per-vendedor
salesCutoffMinutes
number
Minutes before draw to stop sales (0-30)
appliesToDate
string
ISO 8601 date filter (or null to remove filter)
appliesToHour
number
Hour filter 0-23 (or null to remove filter)
multiplierId
string
Multiplier UUID
message
string
Custom message (1-255 characters, or null to remove)

Response

success
boolean
Indicates if the request was successful
data
object
Updated restriction rule (see List endpoint for full schema)

Examples

curl -X PATCH "https://api.example.com/api/v1/restrictions/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "maxAmount": 6000,
    "message": "Límite actualizado"
  }'

Validation Rules

Cannot update a cutoff rule to have amount limits, or vice versa.
If setting isAutoDate = true:
  • number field must be omitted or null
  • Rule must have maxAmount or maxTotal
salesPercentage requires:
  • Value between 0-100
  • Used with amount-based rules only
appliesToVendedor only valid when salesPercentage is present.

Response Example

{
  "success": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "bancaId": "banca-uuid",
    "ventanaId": null,
    "userId": null,
    "number": "25",
    "maxAmount": 6000,
    "message": "Límite actualizado",
    "isActive": true,
    "updatedAt": "2025-03-15T14:30:00.000Z"
  }
}

Error Responses

{
  "success": false,
  "error": "Restriction rule not found",
  "code": "NOT_FOUND"
}

Implementation Details

From src/api/v1/controllers/restrictionRule.controller.ts:15-22:
async update(req: AuthenticatedRequest, res: Response) {
  const rule = await RestrictionRuleService.update(
    req.user!.id,
    req.params.id,
    req.body
  );
  res.json({ success: true, data: rule });
}

Get Restriction

View rule details

Delete Restriction

Soft delete a rule

Restore Restriction

Restore a deleted rule

Build docs developers (and LLMs) love