Skip to main content
Every correction you submit helps the system learn. Corrections drive contradiction detection, rule formulation, and accuracy improvements specific to your data.

Authentication

X-API-Key: am_live_your_key_here

Batch Format (Preferred)

Submit multiple corrections in a single request. Each correction references either a placeholder from the sanitize response or raw text for missed entities.
FieldTypeRequiredDescription
session_idstringYesSession ID from the sanitize response
correctionsarrayYesArray of correction objects (max 50)
corrections[].placeholderstringConditionalReference to [TYPE_N] placeholder. Required for misclassification and false_positive
corrections[].span_textstringConditionalRaw text span. Required for missed_entity
corrections[].correct_typestringConditionalWhat the entity should be classified as. Required for misclassification and missed_entity
corrections[].feedback_typestringYesmisclassification, false_positive, missed_entity, or wrong_type

Example Request

curl -X POST https://api.ambientmeta.com/v1/feedback \
  -H "X-API-Key: am_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "ses_a1b2c3d4e5f6",
    "corrections": [
      {"placeholder": "[PHONE_NUMBER_1]", "correct_type": "NPI", "feedback_type": "misclassification"},
      {"span_text": "Dr. Jane Smith", "correct_type": "PERSON", "feedback_type": "missed_entity"},
      {"placeholder": "[SSN_1]", "feedback_type": "false_positive"}
    ]
  }'

Example Response

{
  "accepted": 3,
  "correction_ids": ["cor_xxx", "cor_yyy", "cor_zzz"],
  "contradictions_detected": 1,
  "message": "Thank you. 1 contradiction detected — check /v1/insights for details.",
  "status": "recorded"
}

Response Fields

FieldTypeDescription
acceptedintegerNumber of corrections accepted
correction_idsarrayIDs assigned to each correction
contradictions_detectedintegerNumber of contradictions found against previous corrections
messagestringHuman-readable summary
statusstringAlways "recorded"
Contradiction detection is automatic. When you correct an entity in one direction (e.g., PHONE_NUMBER to NPI) and a previous correction went the other way (NPI to PHONE_NUMBER), the system detects this as a contradiction and creates an insight. Check GET /v1/insights for details and resolution options.

Feedback Types

TypeWhen to UseRequired Fields
misclassificationEntity was detected but classified as the wrong typeplaceholder + correct_type
wrong_typeAlias for misclassificationplaceholder + correct_type
missed_entitySystem failed to detect an entityspan_text + correct_type
false_positiveSystem flagged something that is not PIIplaceholder

Legacy Single-Correction Format

The original single-correction format is still supported for backwards compatibility.
FieldTypeRequiredDescription
session_idstringYesSession ID from the sanitize response
feedback_typestringYeswrong_type, missed_entity, false_positive, or misclassification
text_snippetstringYesThe text span being corrected
expected_typestringNoWhat the entity should be classified as

Legacy Example

curl -X POST https://api.ambientmeta.com/v1/feedback \
  -H "X-API-Key: am_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "ses_a1b2c3d4e5f6",
    "feedback_type": "wrong_type",
    "text_snippet": "1234567890",
    "expected_type": "NPI"
  }'

SDK Example

from ambientmeta import AmbientMeta

client = AmbientMeta(api_key="am_live_xxx")

# Sanitize first
result = client.sanitize("Contact NPI 1234567890 at 555-867-5309")

# Chain corrections on the result
result.correct("[PHONE_NUMBER_1]", "NPI")         # Misclassified
result.report_missed("Dr. Smith", "PERSON")       # Missed entity
result.report_false_positive("[LOCATION_1]")       # False positive

# Submit all corrections at once
feedback = result.submit_corrections()
print(f"Accepted: {feedback.accepted}, Contradictions: {feedback.contradictions_detected}")

Errors

CodeHTTP StatusDescription
invalid_api_key401API key is missing or invalid
session_not_found404Session ID doesn’t exist or has expired
rate_limited429Too many requests
View all error codes