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

OperationHTTP methodEndpoint pathRequired permissionPurposeSuccess status
Retrieve current accountGET/api/account/Authenticated account-read permissionReturns the account associated with the supplied credentials200 OK
Update current accountPATCH where supported/api/account/Account-write permission; often account owner or administratorChanges supplied writable fields without replacing unspecified fields200 OK or 204 No Content
Replace current accountPUT where explicitly supported/api/account/Account-write permissionReplaces the complete writable representation according to the API contract200 OK or 204 No Content
Manage account settingsGET, PATCH, or provider-defined methodUse the documented settings endpointSettings-read or settings-write permissionReads or changes preferences when settings are modeled separatelyProvider-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/"
  }
}
FieldTypeDescriptionRequired in responseWritableValidation or allowed values
idStringStable Account IDUsually yesNoServer-generated; treat as opaque
display_nameStringHuman-readable account nameProvider-definedOften yesLength, character, and uniqueness rules may apply
contact_addressStringContact email or addressProvider-definedSometimesMust use the documented format; verification may be required
localeStringLanguage and regional formatting preferenceProvider-definedOften yesMust be a supported locale
timezoneStringTime zone used for display or schedulingProvider-definedOften yesMust be a supported time-zone identifier
statusStringCurrent account lifecycle stateUsually yesNoServer-controlled enum
created_atTimestampAccount creation timeProvider-definedNoNormally an ISO 8601 timestamp
updated_atTimestampMost recent account modification timeProvider-definedNoNormally an ISO 8601 timestamp
linksObjectRelated or self linksOptionalNoFollow 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_at or 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.

StatusMeaningAllowed API operationsClient behavior
activeAccount is available for normal useNormal authorized reads and updatesProceed normally
pendingAccount setup or verification is incompleteUsually limited reads and setup actionsPrompt for the required verification or setup step
suspendedAccess is temporarily restrictedOften read-only or administrator-onlyDo not repeatedly retry writes; show an appropriate account-state message
disabledAccount has been turned offProvider-defined recovery or administrator actionsStop normal account operations until re-enabled
deletedAccount has been removed or marked for removalUsually no normal operationsDo 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 OK commonly indicates a successful read or an update returning a representation.
  • 204 No Content commonly indicates a successful update with no response body.
  • Read the response Content-Type before 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-After value supplied by the server.
  • Use ETags, versions, or conditional requests such as If-Match when 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 statusError codeTypical causeRecommended client action
400invalid_requestMalformed JSON, unsupported parameter, or invalid request shapeCorrect the request; do not retry unchanged
401unauthorizedMissing, expired, invalid, or incorrectly formatted credentialsObtain a valid token, verify the scheme, and retry once with corrected authentication
403forbiddenMissing scope, insufficient role, another account is inaccessible, or account state blocks the operationRequest the appropriate permission or use an authorized account; do not blindly retry
404not_foundWrong route or Account ID, nonexistent account, or intentionally hidden inaccessible resourceVerify the route and identifier, then confirm access
409conflictConcurrent modification or incompatible account stateRefresh the resource, resolve the conflict, and submit a deliberate update
422validation_errorField value fails validation or a read-only field was submittedRead field-level details, correct the payload, and resubmit
429rate_limitedToo many requests in a time windowHonor Retry-After, use exponential backoff, and reduce polling
5xxserver_errorTransient server or network-side failureRetry 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

  1. Identify whether the operation targets the authenticated account or an explicitly supported Account ID.
  2. Request the narrowest read or write permission needed.
  3. Send the correct authentication and content-negotiation headers.
  4. For partial updates, send only documented writable fields.
  5. Handle 401, 403, 404, 409, 422, and 429 differently.
  6. Use bounded retries only for transient failures and protect updates against concurrency.
  7. Redact tokens and personal account data from logs.