Create an enrichment
const url = 'https://api.usesonora.com/v1/enrichment-configs';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"title":"example","description":"example","prompt":"example","outputType":"short_text","options":["example"],"multiple":true,"dataSources":["meetings"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.usesonora.com/v1/enrichment-configs \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "title": "example", "description": "example", "prompt": "example", "outputType": "short_text", "options": [ "example" ], "multiple": true, "dataSources": [ "meetings" ] }'Add an enrichment to your customers: a question the AI answers for each one, the shape of the answer, and what it may read. It is visible to everyone in the workspace, like one made in Sonora and shared. Creating it runs nothing and spends no credits — start a run with POST /enrichment-configs/{configId}/runs. Send an Idempotency-Key to make a retry safe.
Requires the enrichments:manage scope. API keys only.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”1–255 printable characters. A retry with the same key and request answers with the first call’s result instead of acting twice.
Request Bodyrequired
Section titled “Request Bodyrequired”An enrichment to add to every customer: a question for the AI, the shape of its answer, and what it may read.
object
The question the AI answers for each customer, in plain language (Markdown is fine): What is the main reason this account might not renew?
What the value is: short_text/long_text a string, number a number, score 1–10 (10 strongest), boolean, date YYYY-MM-DD, email, url, or select one of options (a list of them with multiple).
select only, and required for it: the 2–10 values it picks from.
select only: a value is a list of options rather than one. Defaults to false.
What the AI may read to answer: the customer’s meetings, emails, notes, issues, feature_requests, product_usage, ecsat and engagement, or web_search. A run usually costs 1 credit per customer, or 4 with web_search, which also needs web search on your plan. emails is read with the access of the person who made the enrichment, so only one someone made in Sonora takes it: one created through the API has no owner.
Responses
Section titled “Responses”The enrichment, created.
An enrichment: a field Sonora’s AI fills in on each record, from your calls, emails and tickets.
object
Stable across edits to the enrichment: the configId its values carry.
The kind of record it describes. Only customer today.
What the value is: short_text/long_text a string, number a number, score 1–10 (10 strongest), boolean, date YYYY-MM-DD, email, url, or select one of options (a list of them with multiple).
select only: whether a value is a list of options.
When the enrichment was last edited.
object
This resource’s canonical URL on the API host.
Example
{ "entityType": "customer", "outputType": "short_text"}Headers
Section titled “Headers”A fingerprint of the enrichment’s current version. Send it back as If-Match to update only if nobody has edited it since.
true when this answers a retry with an earlier call’s Idempotency-Key: the first call’s body, replayed.
invalid_json: The request body is not valid JSON.
invalid_request: A parameter or body field is missing, malformed or unknown; details.issues names each.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}unauthorized: The Authorization header is missing, or the key is invalid, revoked or expired.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}insufficient_scope: The key or token lacks the scope this endpoint needs, and details.required names it; or an OAuth access token called an endpoint only an API key can.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}idempotency_key_in_use: A request with this Idempotency-Key is still being processed. Retry once it has finished.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}payload_too_large: The request body is too large; details.maxBytes gives the limit.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}idempotency_key_mismatch: The Idempotency-Key was used before with a different request.
invalid_fields: A field’s value can’t be saved, so nothing was; details.issues names each field and why.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}rate_limited: Too many requests for this key; retry after Retry-After seconds.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}internal_error: Something went wrong on Sonora’s side. Retry, and quote requestId if it persists.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}Try it
Try it runs the reference's read endpoints, and this one changes data, so it needs an API key with the enrichments:manage scope. Create a key in Sonora under Settings → API and call it from your own code.