TheWavlyDocs
DocsAPI reference

Mandates

A mandate records what the user approved: the items, the most per purchase, an optional budget, the allowed payees and merchants, and conditions on the terms. It is signed, versioned and checked on every purchase. See How TheWavly works.

Record what the user approved

POST/v1/mandatesSecret key · scope mandates:write

Parameters

NameInDescription
Idempotency-KeyheaderRepeat a write safely: the same key and body return the first answer.

Request body

FieldTypeDescription
instruction requiredstringup to 1000 characters
approved_by requiredstringYour reference for the user, not their name or phone
agentstring
rules requiredobject
starts_atinteger
expires_atinteger
expires_in_secondsinteger
previousstringMake a new version of this mandate
metadataobject

Returns

FieldTypeDescription
object"mandate"
idstring
versioninteger
livemodeboolean
status"active" | "scheduled" | "expired" | "revoked" | "superseded"
instructionstring
approved_bystring
agentstring or null
rulesobject
usageobject
tokenstring
upiobject
starts_atinteger
expires_atinteger

Errors

Errors return {"error": {"code", "message", "field", "request_id"}} with a 4xx or 5xx status. See Errors.

curl -X POST https://thewavly.com/v1/mandates \
  -H "Authorization: Bearer $WAVLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "instruction": "Order my weekly groceries from FreshCart, up to ₹2,000 an order",
  "approved_by": "user_7f3",
  "agent": "grocer-assistant",
  "rules": {
    "items": [
      "Groceries"
    ],
    "max_amount_paise": 200000,
    "budget_paise": 600000,
    "payees": [
      "freshcart@okhdfc"
    ],
    "currency": "INR"
  }
}'
Response
{
  "id": "chk_P1iENx01EDRJ",
  "status": "paid",
  "instruction": "Order my weekly groceries from FreshCart, up to ₹2,000 an order",
  "approved_by": "user_7f3",
  "agent": "grocer-assistant",
  "token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…"
}

List mandates

GET/v1/mandatesSecret key · scope mandates:read

Parameters

NameInDescription
limitquery
starting_afterqueryAn id from the previous page
agentquery

Returns

FieldTypeDescription
object required"list"
data requiredarray of object
has_more requiredboolean

Errors

Errors return {"error": {"code", "message", "field", "request_id"}} with a 4xx or 5xx status. See Errors.

curl https://thewavly.com/v1/mandates \
  -H "Authorization: Bearer $WAVLY_API_KEY"
Response
{
  "object": "list",
  "data": [
    {
      "object": "mandate",
      "id": "chk_P1iENx01EDRJ",
      "version": 1
    }
  ],
  "has_more": true
}

Import an AP2 or Verifiable Intent open mandate

POST/v1/mandates/importSecret key · scope mandates:write

Parameters

NameInDescription
Idempotency-KeyheaderRepeat a write safely: the same key and body return the first answer.

Request body

FieldTypeDescription
credential requiredstringSD-JWT presentation
issuer_jwksobject
issuer_jwks_urlstring
approved_by requiredstring
defaultsobject
allow_unverifiedboolean

Returns

FieldTypeDescription
object"mandate"
idstring
versioninteger
livemodeboolean
status"active" | "scheduled" | "expired" | "revoked" | "superseded"
instructionstring
approved_bystring
agentstring or null
rulesobject
usageobject
tokenstring
upiobject
starts_atinteger
expires_atinteger

Errors

Errors return {"error": {"code", "message", "field", "request_id"}} with a 4xx or 5xx status. See Errors.

curl -X POST https://thewavly.com/v1/mandates/import \
  -H "Authorization: Bearer $WAVLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "credential": "eyJhbGciOi…~WyJzYWx0Ii…~",
  "approved_by": "user_7f3"
}'
Response
{
  "id": "chk_P1iENx01EDRJ",
  "status": "paid",
  "instruction": "Order my weekly groceries from FreshCart, up to ₹2,000 an order",
  "approved_by": "user_7f3",
  "agent": "grocer-assistant",
  "token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…"
}

Retrieve a mandate with its versions

GET/v1/mandates/{id}Secret key · scope mandates:read

Parameters

NameInDescription
id requiredpathMandate idpattern ^mdt_[\w-]{6,40}$

Returns

FieldTypeDescription
object"mandate"
idstring
versioninteger
livemodeboolean
status"active" | "scheduled" | "expired" | "revoked" | "superseded"
instructionstring
approved_bystring
agentstring or null
rulesobject
usageobject
tokenstring
upiobject
starts_atinteger
expires_atinteger

Errors

Errors return {"error": {"code", "message", "field", "request_id"}} with a 4xx or 5xx status. See Errors.

curl https://thewavly.com/v1/mandates/chk_P1iENx01EDRJ \
  -H "Authorization: Bearer $WAVLY_API_KEY"
Response
{
  "id": "chk_P1iENx01EDRJ",
  "status": "paid",
  "instruction": "Order my weekly groceries from FreshCart, up to ₹2,000 an order",
  "approved_by": "user_7f3",
  "agent": "grocer-assistant",
  "token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…"
}

Revoke a mandate; every later check stops

POST/v1/mandates/{id}/revokeSecret key · scope mandates:write

Parameters

NameInDescription
id requiredpathMandate idpattern ^mdt_[\w-]{6,40}$

Request body

FieldTypeDescription
reasonstringup to 300 characters

Returns

FieldTypeDescription
object"mandate"
idstring
versioninteger
livemodeboolean
status"active" | "scheduled" | "expired" | "revoked" | "superseded"
instructionstring
approved_bystring
agentstring or null
rulesobject
usageobject
tokenstring
upiobject
starts_atinteger
expires_atinteger

Errors

Errors return {"error": {"code", "message", "field", "request_id"}} with a 4xx or 5xx status. See Errors.

curl -X POST https://thewavly.com/v1/mandates/chk_P1iENx01EDRJ/revoke \
  -H "Authorization: Bearer $WAVLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "reason": "not_as_ordered"
}'
Response
{
  "id": "chk_P1iENx01EDRJ",
  "status": "paid",
  "instruction": "Order my weekly groceries from FreshCart, up to ₹2,000 an order",
  "approved_by": "user_7f3",
  "agent": "grocer-assistant",
  "token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…"
}