Update user

Updates an existing customer. Use this to change budgets or contact info. ## Authentication <Note> Public API: use an API key. - `Authorization: Bearer YOUR_API_KEY` (public API) </Note> ## Path params - `customer_identifier` *string* **required**: Your unique identifier for this customer. ## POST params You can add these params to the **body**: ```python url = "https://api.respan.ai/api/users/user_123/" headers = { "Authorization": "Bearer YOUR_API_KEY", } data = { "period_budget": 200.0, "metadata": {"plan": "pro"}, } response = requests.patch(url, headers=headers, json=data) ``` - `email` *string*: Customer email address. - `name` *string*: Customer display name. - `metadata` *object*: Custom metadata associated with this customer (optional). - `period_budget` *number*: Budget for the current period in USD. Set to `null` to remove the budget limit. - `budget_duration` *string*: Budget renewal period. Options: `daily`, `weekly`, `monthly`. - `total_budget` *number*: Total all-time budget limit across all periods (optional). - `markup_percentage` *number*: Markup percentage applied to this customer's usage (optional). ## Request example ```python Python url = "https://api.respan.ai/api/users/user_123/" headers = {"Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"} payload = {"period_budget": 200.0, "metadata": {"plan": "pro"}} resp = requests.patch(url, headers=headers, json=payload) print(resp.json()) ``` ```bash cURL curl -X PATCH "https://api.respan.ai/api/users/user_123/" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "period_budget": 200.0, "metadata": { "plan": "pro" } }' ``` ## Response Returns the updated customer object (same structure as the GET detail endpoint). ```json { "id": 12345, "customer_identifier": "user_123", "unique_organization_id": "8264a3f4-40c7-476a-97d1-96908127ea21", "email": "john@example.com", "name": "John Doe", "environment": "prod", "organization": 456, "period_budget": 200.0, "budget_duration": "monthly", "total_period_usage": 45.67, "period_start": "2025-12-01T00:00:00Z", "period_end": null, "total_budget": null, "total_usage": 523.45, "total_requests": 15420, "total_prompt_tokens": 125000, "total_completion_tokens": 45000, "total_tokens": 170000, "total_cache_hits": 234, "average_latency": 1.23, "average_ttft": 0.45, "average_monthly_cost": 67.89, "top_models": {}, "last_active": "2025-12-29T10:30:00Z", "created_at": "2025-10-15T08:00:00Z", "updated_at": "2025-12-29T10:30:00Z", "metadata": { "plan": "pro" }, "markup_percentage": 0.0, "is_test": false, "blurred": null, "organization_key": null } ``` <Tip> To remove a budget limit, set `period_budget` to `null`. </Tip>

Authentication

AuthorizationBearer
API key authentication. Get your API key from https://platform.respan.ai/platform/api-keys

Path parameters

customer_identifierstringRequired
Your unique identifier for this customer.

Request

This endpoint expects an object.
emailstringOptional
Customer email address.
namestringOptional
Customer display name.
metadataobjectOptional

Custom metadata associated with this customer (optional).

period_budgetdoubleOptional
Budget for the current period in USD. Set to null to remove the budget limit.
budget_durationstringOptional

Budget renewal period. Options: daily, weekly, monthly.

total_budgetdoubleOptional

Total all-time budget limit across all periods (optional).

markup_percentagedoubleOptional

Markup percentage applied to this customer’s usage (optional).

Response

Successful response for Update user
idinteger
customer_identifierstring
unique_organization_idstring
emailstring
namestring
environmentstring
organizationinteger
period_budgetdouble
budget_durationstring
total_period_usagedouble
period_startstring
period_endstring
total_budgetstring
total_usagedouble
total_requestsinteger
total_prompt_tokensinteger
total_completion_tokensinteger
total_tokensinteger
total_cache_hitsinteger
average_latencydouble
average_ttftdouble
average_monthly_costdouble
top_modelsobject
last_activestring
created_atstring
updated_atstring
metadataobject
markup_percentagedouble
is_testboolean
blurredstring
organization_keystring

Errors

401
Unauthorized Error