CouponsSubmitRequest coupons.submit-request@1
Generated at from
openvibe-contracts v0.53.0 and
openvibe-sdk v0.11.0.
- Version
- 1.0.0
- Owner
- coupons
- Visibility
- first-party
- Status
- active
- Compatibility
- backward
- Schema
https://openvibe.network/contracts/coupons/submit-request.v1.json
coupons.submit-request@1: the body of POST /api/v1/coupons/submit on OpenVibe.Coupons (coupons.coupon.submit; a signed-in person, or a service acting for one or as AI; installs cannot submit): a code and the merchant it is for (merchant_id, or the host or url of the shop: an unknown shop becomes a pending merchant). code is 1-64 printable characters without spaces; title (at least 3 characters: what the code gives) is required. status, confidence, verified, working, valid and validity are refused (422 coupon.status_not_accepted): a code's status comes only from people's reports. expires is a date (YYYY-MM-DD) or ISO time; expiry_basis evidence needs evidence_url. A duplicate answers the existing code (200).
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
code | string | yes |
| |
title | string | yes |
| |
description | string | null | |||
merchant_id | string | |||
host | string | |||
url | string |
| ||
expires | string | null | |||
expiry_basis | enum |
| ||
evidence_url | string |
| ||
restrictions | object | |||
restrictions.min_spend | object | |||
restrictions.min_spend.amount | number | string | |||
restrictions.min_spend.currency | string | ISO 4217. | ||
restrictions.categories | array | string | At most 10. | ||
restrictions.new_customers_only | boolean | string | |||
restrictions.regions | array | string | ISO 3166-1 alpha-2 codes, at most 50. | ||
restrictions.other | string |
| ||
hint | string | null |
| ||
ai_run_id | string | null |
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: with-evidence
{
"code": "FALL15",
"title": "15% off sneakers",
"url": "https://shoes.example.com/sneakers",
"expires": "2026-10-31",
"expiry_basis": "evidence",
"evidence_url": "https://shoes.example.com/fall-sale",
"restrictions": {
"min_spend": {
"amount": 50,
"currency": "USD"
},
"new_customers_only": true
}
}Rejected: claims-status
{
"code": "FALL15",
"title": "15% off sneakers",
"host": "shoes.example.com",
"status": "reported_working"
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('coupons.submit-request@1', value); // { valid, errors: [{ path, message }] }