Skip to main content
Enable pay-as-you-go in one flow: save a card, make an initial credit top-up, and optionally turn on auto-top-up (returns a PaymentIntent client secret)
Audience: application and coding agent.

Canonical metadata

  • requestId
  • traceparent

Example request

curl -X POST \
  -H "Authorization: Bearer $SECAPI_BEARER_TOKEN" \
  -H "secapi-version: 2026-03-19" \
  -H "content-type: application/json" \
  -d '{"amountUsd":10,"autoTopupThresholdCents":1000,"autoTopupAmountCents":2500}' \
  "https://api.secapi.ai/v1/billing/payg/enable"
Billing funding changes require a WorkOS bearer session with billing:manage. API keys are rejected so payment setup, refunds, and auto-top-up controls stay limited to interactive billing administrators.

Example response

{
  "object": "payg_enable_intent",
  "clientSecret": "pi_example_secret_example",
  "paymentIntentId": "pi_example",
  "breakdown": {
    "creditsCents": 1000,
    "discountCents": 0,
    "feeCents": 30,
    "totalChargeCents": 1030,
    "currency": "usd"
  },
  "requestId": "req_2ZK8Q1W9F4M6P7R3"
}

Give this prompt to your agent

Failure posture

  • treat non-2xx responses as contract-aware failures, not free-form errors
  • preserve requestId and traceparent in logs and downstream reports
  • if provenance or freshness metadata is present, return it unchanged so trust is not lost in the handoff