API REFERENCE

Commerce Trust API

Verify AI agent transactions before execution. Single and batch endpoints with sub-50ms latency.

Base URL

https://nerq.ai/v1/commerce

Authentication

Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Get your API key at /nerq/docs. Free tier: 1,000 req/hr. Pro: 50,000 req/hr.

POST /v1/commerce/verify

Verify a single agent transaction. Returns approval decision with trust metadata.

Request Body

{
  "agent_id": "shopping-agent-42",
  "counterparty": "vendor-abc",
  "action": "purchase",
  "risk_tolerance": "medium",
  "amount_usd": 250.00,
  "metadata": {
    "category": "electronics",
    "platform": "marketplace-x"
  }
}

Request Fields

FieldTypeRequiredDescription
agent_idstringYesIdentifier of the agent initiating the transaction
counterpartystringYesIdentifier of the vendor or receiving agent
actionstringYesTransaction type: purchase, sell, negotiate, transfer
risk_tolerancestringNoThreshold: low, medium, high. Default: medium
amount_usdnumberNoTransaction amount in USD for risk-adjusted scoring
metadataobjectNoAdditional context (category, platform, etc.)

Response

{
  "approved": true,
  "trust_score": 0.87,
  "agent_trust": {
    "score": 0.87,
    "risk_level": "low",
    "provenance": "verified",
    "last_audit": "2026-03-10"
  },
  "counterparty_trust": {
    "score": 0.92,
    "risk_level": "low",
    "provenance": "verified",
    "last_audit": "2026-03-11"
  },
  "decision": {
    "action": "approve",
    "confidence": 0.94,
    "risk_factors": [],
    "recommendation": "Transaction meets trust threshold for medium risk tolerance."
  },
  "latency_ms": 23
}

Response Fields

FieldTypeDescription
approvedbooleanWhether the transaction is approved
trust_scorenumberCombined trust score (0.0–1.0)
agent_trustobjectTrust details for the initiating agent
counterparty_trustobjectTrust details for the counterparty
decisionobjectDecision metadata with confidence and risk factors
latency_msnumberServer-side processing time in milliseconds

cURL Example

curl -X POST https://nerq.ai/v1/commerce/verify \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "shopping-agent-42",
    "counterparty": "vendor-abc",
    "action": "purchase",
    "risk_tolerance": "medium"
  }'

POST /v1/commerce/verify/batch

Verify multiple transactions in a single request. Max 50 transactions per batch.

Request Body

{
  "transactions": [
    {
      "agent_id": "procurement-bot-7",
      "counterparty": "supplier-alpha",
      "action": "purchase",
      "risk_tolerance": "low"
    },
    {
      "agent_id": "procurement-bot-7",
      "counterparty": "supplier-beta",
      "action": "negotiate",
      "risk_tolerance": "medium"
    }
  ]
}

Response

{
  "results": [
    {
      "index": 0,
      "approved": true,
      "trust_score": 0.91,
      "decision": {"action": "approve", "confidence": 0.95}
    },
    {
      "index": 1,
      "approved": true,
      "trust_score": 0.84,
      "decision": {"action": "approve", "confidence": 0.88}
    }
  ],
  "batch_latency_ms": 67
}

SDK Usage

pip install nerq-commerce

Python SDK

from nerq_commerce import NerqCommerce

client = NerqCommerce(api_key="YOUR_API_KEY")

# Single verification
result = client.verify(
    agent_id="my-agent",
    counterparty="vendor",
    action="purchase",
    risk_tolerance="medium"
)

if result.approved:
    print(f"Approved with score {result.trust_score}")

# Batch verification
results = client.verify_batch([
    {"agent_id": "bot-1", "counterparty": "vendor-a", "action": "purchase"},
    {"agent_id": "bot-1", "counterparty": "vendor-b", "action": "negotiate"},
])

Error Codes

CodeMeaningDescription
400Bad RequestMissing required fields or invalid values. Check agent_id, counterparty, and action.
401UnauthorizedMissing or invalid API key.
429Rate LimitedExceeded rate limit. Free: 1,000 req/hr. Pro: 50,000 req/hr. Retry after Retry-After header.
500Server ErrorInternal error. Retry with exponential backoff. If persistent, contact support.

Rate Limits

TierRateBatch SizeLatency SLA
Free1,000 req/hr10 per batchBest effort
Pro50,000 req/hr50 per batch<50ms p95
EnterpriseCustomCustom<25ms p95

Need help?

Read the Trust Protocol spec for the underlying verification model, or see integration guides for framework-specific setup.