Sign up and contact support to get 100 free checks.Sign up free
AvatarLookup workflow illustration for Check AvatarLookup API Balance Before a Bulk Task
A visual overview of the workflow discussed in this AvatarLookup article.

Use the read-only balance endpoint as one preflight before an AvatarLookup bulk task.

Before submitting a bulk avatar task, call AvatarLookup’s read-only GET /api/v1/balance endpoint with your API key and read data.balance_micros. The field is an integer in USD micros: divide by 1,000,000 to display dollars. Compare that snapshot with a product-specific estimate using current prices and billing rules, then still handle submission errors and reconcile the finished task. A balance read neither runs a check nor guarantees the amount a later task will charge.

Read the balance without starting a check

The AvatarLookup API reference documents GET https://api.avatarlookup.com/api/v1/balance with X-API-Key in the request header. It returns a code, msg, and data envelope; the balance value is data.balance_micros. This endpoint is read-only. It creates no check record and charges nothing. Use a server-side caller that already holds the account key, and avoid putting the key into a URL or client-facing log.

A simple application might read balance when an operator opens a batch submission screen, then read it again immediately before sending the file. Save the timestamp of the second read with the proposed task manifest. The displayed number is a snapshot, because another process using the same account can submit work after the read. It is helpful operational context, not a lock on funds or a promise that the next request will succeed.

If the balance request itself fails or returns an unexpected envelope, stop the preflight display and show that the balance is unavailable. Do not substitute zero, invent a balance from an old screenshot, or interpret an authentication error as insufficient credit. Those are different troubleshooting paths.

Keep micros and dollars in separate variables

The suffix _micros matters. One USD is 1,000,000 USD micros. For example, a response value of 12500000 represents $12.50, not $12,500,000 or 12.5 cents. Store the returned integer as balanceMicros and perform estimates in the same integer unit, or convert once for display. Avoid repeated floating-point conversions while comparing money values.

Build the estimate from the selected AvatarLookup service, not a generic avatar unit price. The current catalog contains separate WhatsApp, Telegram, Viber, LINE, Zalo and supported-email bulk products. Each has its own unit price and, where applicable, a minimum billable quantity if there are billable results. For a proposed LINE file, the current profile specifies a 2,000-result minimum under that condition; a Viber file uses a different minimum. Recheck the pricing page and API documentation when preparing a live task. These figures are product rules, not a submission-size requirement.

Keep the number of prepared identifiers, the selected service type, current unit price, applicable minimum, and expected reservation as separate fields in your preflight record. The file’s original row count is not automatically its accepted count or final billable result count. This separation lets an operator see why an apparent “small file” may require a larger budget and why a later refund may differ from the initial reservation.

Treat the preflight as a decision point, not approval

After the read, decide whether the proposed task is worth submitting with the available balance. A team might reduce an unnecessary list, wait for authorized funding, or proceed with the prepared manifest. It should not submit extra identifiers simply to meet a billing minimum. The endpoint supplies a balance observation; your own application makes the business decision.

A passing comparison cannot reserve capacity or funds by itself. Another job could consume balance before the file arrives, and server-side validation may reject a malformed file. The API documents 40200 for insufficient balance. Handle that response as a submission failure requiring a fresh balance read and operator action, rather than silently retrying the same large task. Keep the task ID only when a task was actually accepted.

Once an asynchronous file task is accepted, its balance reservation and final charge are separate events. Poll the documented task endpoint no more often than every 30 seconds, and inspect the completed task result and billing record. A failed task or one with zero billable results releases the reservation under current product rules; otherwise the final charge follows the product’s billable result count and applicable minimum, with unused reservation returned. A preflight estimate is never the final accounting receipt.

Make the handoff easy to audit

For an operational handoff, keep a small internal record: balance-read time and integer micros, selected service type, prepared identifier count, current price source, applicable minimum, submission outcome and task ID if accepted. After completion, add the task status and final billing figures. This is a suggested customer-side record, not an extra AvatarLookup API object.

The record helps a teammate distinguish three common questions: “What balance was visible before submission?”, “Did the server accept this file task?”, and “What did the finished task actually cost?” Each has a different source of evidence. A balance read answers only the first. Build alerts around those states rather than labeling every low or missing value as a failed avatar check.

If your application already has a task submission flow, add the read-only balance call just before its confirmation step and display the unit conversion explicitly. That gives an operator a useful budget check while preserving the service’s real task and billing states for later reconciliation.

FAQ

Does GET /api/v1/balance create an avatar check or charge?

No. The current API reference describes it as a read-only balance request with no check record or charge.

Is balance_micros a dollar value?

It is an integer count of USD micros. Divide by 1,000,000 for a dollar display while retaining the integer for comparisons.

Does a positive balance mean a bulk file will be accepted?

No. A balance read is a snapshot. The task must still pass service and file validation, and another operation may change available funds before submission.

Learn More

Choose the product information that fits the next step in your workflow.

Sources