Policies API

Policies define what counts as a compliant photo: which categories exist, which criteria the model evaluates, and how many retry attempts to allow. Most callers use a built-in policy ID (scooter_parking, forest_designated_bay, …) and never need to read raw policy data — the SDK fetches it automatically when it needs to render the scanner.

If you're building a custom dashboard or audit tool, the endpoints below expose policy configuration.

Authoring policies

Today, custom policies are created and edited via the Dashboard → Policies UI. Programmatic policy mutation endpoints are on the roadmap — see Custom policy creation for guidance on getting your policy reviewed.

Get policy configuration

text
GET /api/v1/policies/:id/config

Returns the runtime configuration the SDK uses to render the scanner — categories, max attempts, auto-approve behavior, and UI copy. Account defaults are merged in automatically.

Example

curl https://verify.switchlabs.dev/api/v1/policies/scooter_parking/config \
-H "X-API-Key: vai_your_api_key"

Response

json
{
  "maxAttempts": 3,
  "autoApproveOnExhaust": true,
  "uiCopy": {
    "scannerTitle": "End Ride Photo",
    "scannerInstructions": "Step back and take a photo showing your entire bike and its parking location",
    "processingMessage": "Checking parking compliance...",
    "successMessage": "Parking verified — ride complete!",
    "failureMessage": "Parking issue detected",
    "retryMessage": "Please reposition your bike or retake the photo. {remaining} attempts remaining.",
    "exhaustedMessage": "Photo submitted for manual review. Your ride has ended."
  },
  "categories": [
    {
      "id": "good_parking",
      "label": "Good Parking",
      "color": "#22c55e",
      "isCompliant": true,
      "description": "Bike is correctly parked, fully visible, no violations detected."
    },
    {
      "id": "bad_parking",
      "label": "Bad Parking",
      "color": "#ef4444",
      "isCompliant": false,
      "description": "One or more parking violations detected."
    }
  ]
}

Response fields

| Field | Type | Description | | ----------------------- | -------- | -------------------------------------------------------------------------------------------- | | maxAttempts | number | How many retries the SDK allows before falling back to exhaustedMessage. | | autoApproveOnExhaust | boolean | When true, the SDK marks the ride/transaction as resolved after maxAttempts retries. | | uiCopy | object | Translatable UI strings used by the scanner overlay. Supports {remaining} interpolation. | | categories | object[] | Outcome buckets exposed to the model — drive color/label on the result screen. |

List policies (planned)

text
GET /api/v1/policies
Not yet available

Listing the policies attached to a customer programmatically is not yet supported. Until it ships, view available policies under Dashboard → Policies or contact support for a JSON dump.

Create / update policies (planned)

text
POST   /api/v1/policies
PATCH  /api/v1/policies/:id
DELETE /api/v1/policies/:id

Programmatic CRUD on custom policies is on the roadmap. Today, policies ship as Supabase migrations authored by VerifyAI staff — see Custom policy creation for the path forward.

Get in Touch

Questions about pricing, integrations, or custom deployments? We'd love to hear from you.