API reference

Update account settings

Update privileged account-level API settings. Review Diffio API behavior, response fields, setup details, and production workflows.

Update account billing policy settings with an admin-capable API key.

POST/v1/account/settings/updatePermissions: admin, account:write

Endpoint

HTTP request

https://api.diffio.ai/v1/account/settings/update

Use POST with a JSON body.

Permissions

admin, account:write

API keys must be active.

Authentication

Send the API key on every request using one of the supported headers.

  • Authorization: Bearer <apiKey>
  • X-Api-Key: <apiKey>
  • Xi-Api-Key: <apiKey>

Request

Send the billing policy object to store for the account.

Body fields

FieldTypeRequiredDescription
billingPolicyobjectYesBilling policy to store on the account.
billingPolicy.typestringYesSupported values are customerStripe and internalDiffio.
billingPolicy.reasonstringNoOptional reason stored with the policy update.
cURL
curl -X POST "https://api.diffio.ai/v1/account/settings/update" \  -H "Authorization: Bearer $DIFFIO_AGENT_KEY" \  -H "Content-Type: application/json" \  -d '{    "billingPolicy": {      "type": "customerStripe",      "reason": "Use standard Stripe billing"    }  }'

Response

Returns the updated account settings.

Response fields

FieldTypeRequiredDescription
accountobjectYesUpdated account settings object.
account.userIdstringYesFirebase user id that owns the API account.
account.billingModestringYesBilling mode stored for the account.
account.billingStatusstringYesBilling status stored for the account.
account.billingPolicyobjectYesUpdated billing policy.
account.billingPolicy.typestringYesStored billing policy type.
account.currencystringYesAccount billing currency.
account.updatedAtstringNoLast account update timestamp in ISO 8601 format when available.
Successful response
{  "account": {    "userId": "user_123",    "billingMode": "developerProgressive",    "billingStatus": "active",    "billingPolicy": {      "type": "customerStripe",      "updatedAt": "2026-05-09T12:00:00Z",      "updatedByKeyId": "key_123",      "reason": "Use standard Stripe billing"    },    "currency": "usd",    "updatedAt": "2026-05-09T12:00:00Z"  }}

Return codes

  • 200Success, treated as complete.: Account settings updated.
  • 204Success, treated as empty response.: CORS preflight when method is OPTIONS.
  • 400Bad request, treated as client error.: Invalid JSON body, billingPolicy is required, billingPolicy must be an object, or billingPolicy.type is not supported.
  • 401Unauthorized, treated as auth error.: Missing API key, or invalid API key.
  • 403Forbidden, treated as permission error.: Privileged admin API key required, API key is not active, or missing account:write permission.
  • 405Client error, treated as fix required.: Method is not POST.
  • 500Server error, treated as retryable.: API key missing userId, or failed to update account settings.

Notes

  • Only admin-capable API keys can call this endpoint.
  • The endpoint writes an audit log entry for billing policy changes.
  • Scoped keys cannot use this endpoint even when they include account:write.