Replace allergies
/v1/practices/{practiceId}/patients/{patientId}/allergiesReplaces the patient's structured allergy record. Sending no_known is the explicit no-known-allergies acknowledgement; recorded requires at least one entry. Idempotency-Key is required.
Request example
Replace example values with your Test data. Check the field rules below before you send a request.
{
"allergies": [
{
"category": "drug",
"code": "<string>",
"codeSystem": "rxnorm",
"reactions": [
{
"code": "<string>",
"codeSystem": "snomed-ct",
"display": "<string>"
}
],
"severity": "mild",
"source": "Doctor",
"substance": "<string>",
"type": "allergy",
"verificationStatus": "unconfirmed"
}
],
"reviewStatus": "not_reviewed"
}curl -X PUT 'https://api.affinityrx.com/v1/practices/{practiceId}/patients/{patientId}/allergies' \
-H "Authorization: Bearer $AFFINITY_API_KEY" \
-H 'Affinity-Version: 2026-09-28' \
-H 'Idempotency-Key: <Idempotency-Key>' \
-H 'Content-Type: application/json' \
--data @request.jsonResponse example
These examples show the body structure. Values can differ. Select a status code to see its response.
{
"allergies": [
{
"category": "drug",
"code": "<string>",
"codeSystem": "rxnorm",
"id": "alg_01j2y8m6jcc9tt24af5pw9x1bc",
"reactions": [
{
"code": "<string>",
"codeSystem": "snomed-ct",
"display": "<string>"
}
],
"severity": "mild",
"source": "Doctor",
"substance": "<string>",
"type": "allergy",
"verificationStatus": "unconfirmed"
}
],
"reviewStatus": "not_reviewed"
}{
"code": "<string>",
"data": "<string>",
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 400,
"title": "<string>",
"traceId": "<string>",
"type": "<string>"
}{
"code": "<string>",
"data": "<string>",
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 401,
"title": "<string>",
"traceId": "<string>",
"type": "<string>"
}{
"code": "<string>",
"data": "<string>",
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 403,
"title": "<string>",
"traceId": "<string>",
"type": "<string>"
}{
"code": "<string>",
"data": "<string>",
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 404,
"title": "<string>",
"traceId": "<string>",
"type": "<string>"
}{
"code": "<string>",
"data": "<string>",
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 409,
"title": "<string>",
"traceId": "<string>",
"type": "<string>"
}{
"code": "<string>",
"data": "<string>",
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 422,
"title": "<string>",
"traceId": "<string>",
"type": "<string>"
}{
"code": "<string>",
"data": "<string>",
"detail": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 429,
"title": "<string>",
"traceId": "<string>",
"type": "<string>"
}Implementation specification
Use these field types and limits to build your integration. Download the OpenAPI document for the complete contract.
Path parameters
patientIdstringrequiredPattern: ^pat_[0-7][0-9a-hjkmnp-tv-z]{25}$
practiceIdstringrequiredPattern: ^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$
Headers
Affinity-VersionstringSelects the HTTP API contract for this request only. When omitted, API-key requests use their service account’s stored version. Does not change the stored default.
Pin requests to 2026-09-28.
Idempotency-KeystringrequiredAffinity-Actor-IdstringRequired for user actors and optional for system actors. Omit both actor headers to use the authenticated service account as a system actor.
Affinity-Actor-TypestringUse user when a person initiated the action and system for autonomous work. Omit both actor headers to default to system.
Request body specification application/json
allergiesobject[]requiredMaximum items: 50
Show allergies fields
Array items · object
categorystringrequiredAllowed: "drug", "food", "insect", "latex", "mold", "pet", "pollen", "environmental", "biologic", "other"
codestring | null | nullShow code fields
Any of · 1: string | null
Any of · 1: string
string
Any of · 2: null
null
Any of · 2: null
null
codeSystemstring | null | null | nullShow codeSystem fields
Any of · 1: string | null | null
Any of · 1: string | null
Any of · 1: string
string
Allowed: "rxnorm", "snomed-ct"
Any of · 2: null
null
Any of · 2: null
null
Any of · 2: null
null
reactionsobject[]requiredMaximum items: 20
Show reactions fields
Array items · object
codestring | null | nullShow code fields
Any of · 1: string | null
Any of · 1: string
string
Any of · 2: null
null
Any of · 2: null
null
codeSystemstring | null | nullShow codeSystem fields
Any of · 1: string | null
Any of · 1: string
string
Allowed: "snomed-ct"
Any of · 2: null
null
Any of · 2: null
null
displaystringrequiredseveritystring | null | null | nullShow severity fields
Any of · 1: string | null | null
Any of · 1: string | null
Any of · 1: string
string
Allowed: "mild", "moderate", "severe", "unknown"
Any of · 2: null
null
Any of · 2: null
null
Any of · 2: null
null
sourcestringrequiredAllowed: "Doctor", "Patient", "Patient Agent/Guardian", "Pharmacist"
substancestringrequiredtypestring | nullrequiredShow type fields
Any of · 1: string
string
Allowed: "allergy", "intolerance"
Any of · 2: null
null
verificationStatusstringrequiredAllowed: "unconfirmed", "presumed", "confirmed"
reviewStatusstringrequiredAllowed: "not_reviewed", "no_known", "recorded"
Response specifications
200Successful response
application/json
allergiesobject[]requiredShow allergies fields
Array items · object
categorystringrequiredAllowed: "drug", "food", "insect", "latex", "mold", "pet", "pollen", "environmental", "biologic", "other"
codestring | nullrequiredShow code fields
Any of · 1: string
string
Any of · 2: null
null
codeSystemstring | nullrequiredShow codeSystem fields
Any of · 1: string
string
Allowed: "rxnorm", "snomed-ct"
Any of · 2: null
null
idanyrequiredShow id fields
All of · 1: any
any
Pattern: ^alg_[0-7][0-9a-hjkmnp-tv-z]{25}$
reactionsobject[]requiredShow reactions fields
Array items · object
codestring | nullrequiredShow code fields
Any of · 1: string
string
Any of · 2: null
null
codeSystemstring | nullrequiredShow codeSystem fields
Any of · 1: string
string
Allowed: "snomed-ct"
Any of · 2: null
null
displaystringrequiredseveritystring | nullrequiredShow severity fields
Any of · 1: string
string
Allowed: "mild", "moderate", "severe", "unknown"
Any of · 2: null
null
sourcestringrequiredAllowed: "Doctor", "Patient", "Patient Agent/Guardian", "Pharmacist"
substancestringrequiredtypestring | nullrequiredShow type fields
Any of · 1: string
string
Allowed: "allergy", "intolerance"
Any of · 2: null
null
verificationStatusstringrequiredAllowed: "unconfirmed", "presumed", "confirmed"
reviewStatusstringrequiredAllowed: "not_reviewed", "no_known", "recorded"
400HTTP 400
application/json
codestringrequireddataobjectdetailstringrequiredinstancestringrequiredrequestIdstringrequiredstatusintegerrequiredMinimum: 400
Maximum: 599
titlestringrequiredtraceIdstringtypestringrequiredFormat: uri
401Unauthorized
application/json
codestringrequireddataobjectdetailstringrequiredinstancestringrequiredrequestIdstringrequiredstatusintegerrequiredMinimum: 400
Maximum: 599
titlestringrequiredtraceIdstringtypestringrequiredFormat: uri
403Forbidden
application/json
codestringrequireddataobjectdetailstringrequiredinstancestringrequiredrequestIdstringrequiredstatusintegerrequiredMinimum: 400
Maximum: 599
titlestringrequiredtraceIdstringtypestringrequiredFormat: uri
404Not found
application/json
codestringrequireddataobjectdetailstringrequiredinstancestringrequiredrequestIdstringrequiredstatusintegerrequiredMinimum: 400
Maximum: 599
titlestringrequiredtraceIdstringtypestringrequiredFormat: uri
409Conflict
application/json
codestringrequireddataobjectdetailstringrequiredinstancestringrequiredrequestIdstringrequiredstatusintegerrequiredMinimum: 400
Maximum: 599
titlestringrequiredtraceIdstringtypestringrequiredFormat: uri
422Validation error
application/json
codestringrequireddataobjectdetailstringrequiredinstancestringrequiredrequestIdstringrequiredstatusintegerrequiredMinimum: 400
Maximum: 599
titlestringrequiredtraceIdstringtypestringrequiredFormat: uri
429Too many requests
application/json
codestringrequireddataobjectdetailstringrequiredinstancestringrequiredrequestIdstringrequiredstatusintegerrequiredMinimum: 400
Maximum: 599
titlestringrequiredtraceIdstringtypestringrequiredFormat: uri