Skip to content

Update an enrichment

PATCH
/enrichment-configs/{configId}
curl --request PATCH \
--url https://api.usesonora.com/v1/enrichment-configs/example \
--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" ] }'

Change an enrichment’s settings, as an edit in Sonora does: the change is a new version, its id stays the same, and values already worked out keep the settings they were worked out under until the next run. An enrichment Sonora built from something other than a prompt only takes title and description. Send If-Match with the ETag you read to refuse the change if someone edited it in between.

Requires the enrichments:manage scope. API keys only.

configId
required
string

The enrichment’s id.

If-Match
string

The ETag from your last read. If the resource has changed since, nothing is written and the call answers 412 precondition_failed. Without it, the last write wins.

Media typeapplication/json

The settings to change. A field you leave out is kept, and a value equal to the current one is not a change.

object
title
string
>= 1 characters <= 120 characters
description
Any of:
string
<= 1000 characters
prompt

The question the AI answers for each customer, in plain language (Markdown is fine): What is the main reason this account might not renew?

string
>= 1 characters <= 12000 characters
outputType

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).

string
Allowed values: short_text long_text number score boolean date email url select
options

select only, and required for it: the 2–10 values it picks from.

Array<string>
>= 2 items <= 10 items
multiple

select only: a value is a list of options rather than one. Defaults to false.

boolean
dataSources

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.

Array<string>
>= 1 items <= 9 items
Allowed values: meetings emails notes issues feature_requests product_usage ecsat engagement web_search

The enrichment, as saved.

Media typeapplication/json

An enrichment: a field Sonora’s AI fills in on each record, from your calls, emails and tickets.

object
id
required

Stable across edits to the enrichment: the configId its values carry.

string
title
required
string
description
required
string | null
entityType
required

The kind of record it describes. Only customer today.

string
Allowed values: customer
outputType
required

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).

string
Allowed values: short_text long_text number score boolean date email url select
options
required
Any of:
Array<string>
multiple
required

select only: whether a value is a list of options.

boolean
createdAt
required
string format: date-time
updatedAt
required

When the enrichment was last edited.

string format: date-time
links
required
object
self
required

This resource’s canonical URL on the API host.

string
Example
{
"entityType": "customer",
"outputType": "short_text"
}
ETag
string

A fingerprint of the enrichment’s current version. Send it back as If-Match to update only if nobody has edited it since.

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.

Media typeapplication/json

The one error shape every endpoint answers with.

object
error
required
object
code
required

Stable snake_case code to branch on; see the error table.

string
message
required

For humans; may change.

string
details
object
key
additional properties
requestId
required

Quote it when asking for help.

string | null
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.

Media typeapplication/json

The one error shape every endpoint answers with.

object
error
required
object
code
required

Stable snake_case code to branch on; see the error table.

string
message
required

For humans; may change.

string
details
object
key
additional properties
requestId
required

Quote it when asking for help.

string | null
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.

Media typeapplication/json

The one error shape every endpoint answers with.

object
error
required
object
code
required

Stable snake_case code to branch on; see the error table.

string
message
required

For humans; may change.

string
details
object
key
additional properties
requestId
required

Quote it when asking for help.

string | null
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
},
"requestId": "example"
}
}

enrichment_config_not_found: No enrichment with that id, or not one a key can read.

Media typeapplication/json

The one error shape every endpoint answers with.

object
error
required
object
code
required

Stable snake_case code to branch on; see the error table.

string
message
required

For humans; may change.

string
details
object
key
additional properties
requestId
required

Quote it when asking for help.

string | null
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
},
"requestId": "example"
}
}

enrichment_config_busy: The enrichment was being edited at the same moment, so nothing changed. Retry the call.

Media typeapplication/json

The one error shape every endpoint answers with.

object
error
required
object
code
required

Stable snake_case code to branch on; see the error table.

string
message
required

For humans; may change.

string
details
object
key
additional properties
requestId
required

Quote it when asking for help.

string | null
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
},
"requestId": "example"
}
}

precondition_failed: The resource changed since the ETag that If-Match names. Read it again, then retry.

Media typeapplication/json

The one error shape every endpoint answers with.

object
error
required
object
code
required

Stable snake_case code to branch on; see the error table.

string
message
required

For humans; may change.

string
details
object
key
additional properties
requestId
required

Quote it when asking for help.

string | null
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.

Media typeapplication/json

The one error shape every endpoint answers with.

object
error
required
object
code
required

Stable snake_case code to branch on; see the error table.

string
message
required

For humans; may change.

string
details
object
key
additional properties
requestId
required

Quote it when asking for help.

string | null
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
},
"requestId": "example"
}
}

invalid_fields: A field’s value can’t be saved, so nothing was; details.issues names each field and why.

Media typeapplication/json

The one error shape every endpoint answers with.

object
error
required
object
code
required

Stable snake_case code to branch on; see the error table.

string
message
required

For humans; may change.

string
details
object
key
additional properties
requestId
required

Quote it when asking for help.

string | null
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
},
"requestId": "example"
}
}

rate_limited: Too many requests for this key; retry after Retry-After seconds.

Media typeapplication/json

The one error shape every endpoint answers with.

object
error
required
object
code
required

Stable snake_case code to branch on; see the error table.

string
message
required

For humans; may change.

string
details
object
key
additional properties
requestId
required

Quote it when asking for help.

string | null
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.

Media typeapplication/json

The one error shape every endpoint answers with.

object
error
required
object
code
required

Stable snake_case code to branch on; see the error table.

string
message
required

For humans; may change.

string
details
object
key
additional properties
requestId
required

Quote it when asking for help.

string | null
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.