Skip to main content

Overview

Sales and research tools qualify leads and companies against a rule that a record either satisfies or not. Most records already carry enough data to decide whether the rule is satisfied. For a smaller set, one field is missing, and without it the record can’t be scored at all. Buying a bulk enrichment feed to fill a field you only need on a fraction of your rows can be inefficient. Calling a retrieval API on demand, only for the rows that are actually missing the field, is more focused. This tutorial walks through how to enrich a missing field using the Seltz Answer endpoint.

Outline

  1. Check your own store first.
  2. Retrieve and extract the value with a single Answer call, only when you have to.
  3. Cache it with an expiry so you don’t pay for the same lookup twice.
The examples in this tutorial enrich a company record with a missing headcount band, but the same pattern applies to a lead record missing any attribute you can look up rather than store.

1. Check your own store first.

Before calling Seltz Answer, look the field up wherever you already keep it. Only call out to Answer when the field comes back empty. Teams tracking lead or company records for a sales or research workflow typically keep them in a relational database such as Postgres or MySQL. The examples below assume a companies table with headcount_band and headcount_band_expires_at columns, queried directly with SQL rather than through an ORM, to keep the example dependency-light. conn and pool stand in for a connection or connection pool that your application has already configured.
The next two steps build the enrich_headcount_band / enrichHeadcountBand function from the example above.

2. Retrieve and extract the value with a single Answer call.

Rather than searching and then parsing the missing field out of raw documents yourself, you can use answer with a response_format JSON schema. Passing scope: "companies" grounds the answer in company profiles, and the schema shapes the result directly into the field you need: no separate extraction step is required. As with search, anchor the query with what you already know about the entity, such as industry, location, or a product line, since a bare name is a weak query on this scope.
See Client Reference for the full response_format behavior, including how a malformed schema is rejected before the request is billed. A malformed schema aside, generation can still be truncated partway through, in which case response.answer won’t parse as valid JSON. The example above guards for that and returns None rather than raising an exception. Treat a None the same as a miss, and don’t write a placeholder value back to your store to avoid masking a missing field.

3. Write the value back to your store with a TTL.

Once you have a value, save it with an expiry rather than treating it as permanent. How long to keep it is a judgment call you make based on how quickly the attribute changes. For example, a headcount band and a funding round probably use different expiries.

4. Let the TTL determine refresh frequency.

When a cached value expires, the lookup in step 1 misses again and steps 2 and 3 run once more. But this is a refresh of a field you already hold, not a new discovery. This way, steady-state spend scales with new records plus expiries, not your total row count. A table that’s mostly stable costs little to keep current; a table with a fast-moving attribute costs more, in proportion to how often that attribute actually changes.

Beyond company records

The same check-fetch-cache pattern works for any missing field a scope can answer. Swap scope: "companies" for people to fill in a contact’s current title or employer on a candidate or lead record, or for news to enrich a company record with a recent, relevant news signal. Only the query, the response schema, and the anchor terms change.

Try it out

Ready to see it work on your own data? Try Seltz Answer in the Seltz Console today.

Next steps

  • Companies — What a companies-scope result contains
  • Client Reference — Full response_format and answer behavior
  • Data Concepts — How scopes work across Seltz endpoints
  • Structured responses: Step-by-step guidance on schema design, query anchoring, and worked examples across every data scope