APIs: Concepts, Design, Requests, Responses, and Integration
Account API
Learn how to authenticate, retrieve, update, and secure account data, profiles, settings, statuses, and error handling through the Account API.
An account is the top-level identity or customer entity represented by an API. It may own users, subscriptions, permissions, projects, or other related resources. Account endpoints let an authorized application read account data and, where permitted, change profile information or account preferences.
This guide uses the current-account endpoint at /api/account/. Unless an API explicitly documents an account-ID route, do not assume that replacing the path with an identifier will access another account.
Account resource overview
The authenticated account is the account associated with the credentials in the request. A request to the current-account endpoint operates on that account, commonly called “me” in API designs.
An account resource can contain several kinds of information:
- Identity: the stable account identifier and other server-generated identifiers.
- Profile: descriptive information shown to users or organizations, such as a display name, contact address, locale, or timezone.
- Settings: configurable account-level preferences, such as notifications, privacy, or display options.
- Status: the lifecycle or access state, such as active or suspended.
- Related resources: users, members, organizations, roles, subscriptions, or audit records linked to the account.
An Account ID is a stable identifier used to reference an account resource. A Profile is user- or organization-facing descriptive information. Account settings are configurable preferences and account-level options. These concepts may be returned together or exposed through separate endpoints.
Authentication and authorization
Account endpoints require authentication. Send an access token using the authentication scheme defined by the API, normally a bearer token in the Authorization header.
curl "$API_BASE_URL/api/account/" \
-H "Authorization: Bearer $API_ACCESS_TOKEN" \
-H "Accept: application/json"Authentication proves who is making the request. Authorization determines what that caller may do. An authorization scope is a permission granted to an access token that controls allowed operations. APIs may also enforce roles, account ownership, administrator privileges, or resource-specific policies.
- Reading the authenticated account normally requires an account-read scope or equivalent permission.
- Updating profile data normally requires an account-write scope and may require the caller to be the account owner.
- Changing security-sensitive settings, credentials, ownership, or membership generally requires a stronger scope or administrator role.
- Reading or modifying another account must be explicitly supported and authorized; possession of an Account ID alone is not permission.
Account owners and administrators may have access to fields that ordinary members cannot read or change. Never use a broad administrator token when a narrower account-read or account-write token is sufficient.
Endpoint reference
| Operation | HTTP method | Endpoint path | Required permission | Purpose | Success status |
|---|---|---|---|---|---|
| Retrieve current account | GET | /api/account/ | Authenticated account-read permission | Returns the account associated with the supplied credentials | 200 OK |
| Update current account | PATCH where supported | /api/account/ | Account-write permission; often account owner or administrator | Changes supplied writable fields without replacing unspecified fields | 200 OK or 204 No Content |
| Replace current account | PUT where explicitly supported | /api/account/ | Account-write permission | Replaces the complete writable representation according to the API contract | 200 OK or 204 No Content |
| Manage account settings | GET, PATCH, or provider-defined method | Use the documented settings endpoint | Settings-read or settings-write permission | Reads or changes preferences when settings are modeled separately | Provider-defined successful status |
The current-account route is the safe default for an application acting on the signed-in account. An API that supports other accounts may document a separate route containing an Account ID. Do not construct such a route unless it is part of the API contract.
Retrieving account details
Use GET /api/account/ with an authentication header and an Accept: application/json header. This endpoint does not require a request body.
export API_BASE_URL="https://api.example.test"
export API_ACCESS_TOKEN="replace-with-a-secret-from-your-secret-store"
curl "$API_BASE_URL/api/account/" \
-H "Authorization: Bearer $API_ACCESS_TOKEN" \
-H "Accept: application/json"The exact API may support query parameters for field selection, expansion, or an API version. Use only parameters documented by that API. If no field-selection feature is documented, retrieve the standard representation and ignore unknown response fields for forward compatibility.
A typical response has a structure like the following. The names and writable behavior must be verified against the API schema.
{
"id": "acct_123",
"display_name": "Example Account",
"contact_address": "owner@example.test",
"locale": "en-US",
"timezone": "UTC",
"status": "active",
"created_at": "2026-01-15T10:20:30Z",
"updated_at": "2026-08-25T12:00:00Z",
"links": {
"self": "/api/account/"
}
}| Field | Type | Description | Required in response | Writable | Validation or allowed values |
|---|---|---|---|---|---|
id | String | Stable Account ID | Usually yes | No | Server-generated; treat as opaque |
display_name | String | Human-readable account name | Provider-defined | Often yes | Length, character, and uniqueness rules may apply |
contact_address | String | Contact email or address | Provider-defined | Sometimes | Must use the documented format; verification may be required |
locale | String | Language and regional formatting preference | Provider-defined | Often yes | Must be a supported locale |
timezone | String | Time zone used for display or scheduling | Provider-defined | Often yes | Must be a supported time-zone identifier |
status | String | Current account lifecycle state | Usually yes | No | Server-controlled enum |
created_at | Timestamp | Account creation time | Provider-defined | No | Normally an ISO 8601 timestamp |
updated_at | Timestamp | Most recent account modification time | Provider-defined | No | Normally an ISO 8601 timestamp |
links | Object | Related or self links | Optional | No | Follow only documented links |
Updating account information
A partial update changes only the fields supplied in the request. When supported, PATCH is appropriate for changing one profile attribute without resending the complete resource.
curl -X PATCH "$API_BASE_URL/api/account/" \
-H "Authorization: Bearer $API_ACCESS_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
--data '{
"display_name": "Updated Account Name"
}'A successful update may return the updated account with 200 OK, or return no body with 204 No Content. If a representation is returned, use it as the authoritative result rather than assuming the server accepted every submitted value unchanged.
PUT, when supported, usually means full replacement. A full replacement can require every required writable field and may reset omitted optional fields. Do not use PUT based only on convention; confirm its semantics in the API contract.
Absent, null, empty, and unchanged values
- Absent: in a partial update, usually means “leave this field unchanged.” In a replacement request, it may mean “remove” or may fail validation.
- Null: may clear a nullable field, or may be rejected if the field is required or non-nullable.
- Empty string: is a value, not the same as absence. It may be rejected or accepted as an empty value.
- Unchanged value: is normally harmless, but still counts as a request and may update
updated_ator consume rate limit.
Send only documented writable fields. Do not submit id, status, timestamps, permissions, links, or other read-only properties. Validate formats and required fields before sending the request.
Account settings and preferences
Profile data describes the account; settings control behavior. Common settings include locale, timezone, notification delivery, privacy options, and display preferences.
An API may embed settings in the account representation or expose them through a separate settings resource. Check the endpoint contract rather than assuming that a profile update also changes preferences. See the available Settings API documentation when settings are modeled separately.
curl -X PATCH "$API_BASE_URL/api/settings/" \
-H "Authorization: Bearer $API_ACCESS_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
--data '{
"locale": "en-US",
"timezone": "UTC",
"notifications": {
"product_updates": false
}
}'This example is illustrative: use the actual documented settings path, field names, and permission requirements. A settings update should not be used to change identity, ownership, credentials, or account status.
Account lifecycle and status
Account status indicates the account's current lifecycle or access state. Status values and transitions are provider-specific.
| Status | Meaning | Allowed API operations | Client behavior |
|---|---|---|---|
active | Account is available for normal use | Normal authorized reads and updates | Proceed normally |
pending | Account setup or verification is incomplete | Usually limited reads and setup actions | Prompt for the required verification or setup step |
suspended | Access is temporarily restricted | Often read-only or administrator-only | Do not repeatedly retry writes; show an appropriate account-state message |
disabled | Account has been turned off | Provider-defined recovery or administrator actions | Stop normal account operations until re-enabled |
deleted | Account has been removed or marked for removal | Usually no normal operations | Do not assume recovery is possible |
Activation, deactivation, recovery, and deletion may be separate actions or may not be available through the API. Deletion can be irreversible, can revoke access immediately, and may place data into a retention or purge process. Confirm retention, recovery, and dependent-resource behavior before exposing deletion in an application.
Response handling
200 OKcommonly indicates a successful read or an update returning a representation.204 No Contentcommonly indicates a successful update with no response body.- Read the response
Content-Typebefore parsing a body. - Preserve request or correlation IDs from response headers for support and debugging, but do not expose sensitive headers to end users.
- Honor rate-limit headers and any
Retry-Aftervalue supplied by the server. - Use ETags, versions, or conditional requests such as
If-Matchwhen the API provides them.
The account endpoint represents one resource, so pagination normally does not apply. Pagination is relevant only when an account route returns a collection, such as a list of accounts or related members.
Errors and edge cases
| HTTP status | Error code | Typical cause | Recommended client action |
|---|---|---|---|
400 | invalid_request | Malformed JSON, unsupported parameter, or invalid request shape | Correct the request; do not retry unchanged |
401 | unauthorized | Missing, expired, invalid, or incorrectly formatted credentials | Obtain a valid token, verify the scheme, and retry once with corrected authentication |
403 | forbidden | Missing scope, insufficient role, another account is inaccessible, or account state blocks the operation | Request the appropriate permission or use an authorized account; do not blindly retry |
404 | not_found | Wrong route or Account ID, nonexistent account, or intentionally hidden inaccessible resource | Verify the route and identifier, then confirm access |
409 | conflict | Concurrent modification or incompatible account state | Refresh the resource, resolve the conflict, and submit a deliberate update |
422 | validation_error | Field value fails validation or a read-only field was submitted | Read field-level details, correct the payload, and resubmit |
429 | rate_limited | Too many requests in a time window | Honor Retry-After, use exponential backoff, and reduce polling |
5xx | server_error | Transient server or network-side failure | Retry safely with bounded exponential backoff and request correlation |
A validation error is returned when submitted account data does not satisfy API requirements. Prefer structured field-level errors when available, because they let a client identify the exact property that needs correction.
An inactive or incomplete account may authenticate successfully but still be unable to perform particular operations. Treat an authorization failure and an account-state restriction as separate possibilities. A provider may also return 404 instead of 403 to avoid revealing whether an inaccessible account exists.
Safe retries and concurrency
Do not retry invalid JSON, unsupported fields, failed authorization, or validation errors without changing the request. Retry transient network failures and selected 5xx or 429 responses only with bounded exponential backoff. For updates, use an idempotency mechanism if the API provides one, and use ETags or version checks to prevent one client from silently overwriting another client's changes.
Security and privacy
- Keep access tokens, refresh tokens, passwords, recovery codes, and credentials in a secret manager or protected environment variables.
- Never place tokens directly in source code, browser URLs, shell history, screenshots, or error messages.
- Redact contact addresses, Account IDs when sensitive, status details, and other personal data from logs unless operationally necessary.
- Use least privilege: request only the scopes and roles required for the operation.
- Do not trust client-supplied identifiers, roles, status values, timestamps, or ownership fields.
- Use HTTPS and validate the API host and certificate through the normal platform security controls.
- Display only the account fields needed by the user interface.
- Confirm destructive actions, protect them with appropriate authorization, and document retention consequences.
Troubleshooting
401 Unauthorized
Check that the Authorization header is present, uses the correct scheme, and contains a current token. Verify that the token has not expired and that the request is sent to the intended API base URL.
403 Forbidden
The token may lack the required account scope, the caller may be trying to access another account, or the account's role or status may block the operation. Obtain the appropriate permission or confirm that the caller is authorized; do not treat a new retry as a permission grant.
400 or 422 during an update
Inspect the structured error payload. Correct malformed JSON, remove unsupported or read-only fields, and use valid values for locale, timezone, contact information, and other constrained properties.
404 Not Found
Confirm the endpoint path and any Account ID. The account may not exist, or the API may intentionally conceal inaccessible resources. Avoid probing identifiers.
Concurrent updates overwrite changes
Refresh the account before updating and use a version, ETag, or conditional request if available. If the API has no concurrency control, minimize stale updates and clearly define which client is authoritative.
Rate limiting
Stop unnecessary polling, cache account data for an appropriate period, honor Retry-After, and apply exponential backoff with jitter for retryable responses.
Environment configuration
Keep deployment-specific values outside source code. The following shell configuration uses environment variables; load the token from a secure secret store in production.
export API_BASE_URL="https://api.example.test"
export API_ACCESS_TOKEN="token-supplied-by-your-secret-store"Practical checklist
- Identify whether the operation targets the authenticated account or an explicitly supported Account ID.
- Request the narrowest read or write permission needed.
- Send the correct authentication and content-negotiation headers.
- For partial updates, send only documented writable fields.
- Handle
401,403,404,409,422, and429differently. - Use bounded retries only for transient failures and protect updates against concurrency.
- Redact tokens and personal account data from logs.