Update a practice
/v1/practices/{practiceId}
liveEnabled allows or refuses new Live orders. Existing records, cancellation, webhooks and billing keep working. Only its platform changes it; enabling requires platform Live access, and either change needs a Live caller: a Live key (403 live_key_required otherwise) or a session in Live mode (403 live_mode_required otherwise). Live orders send name, phone and address to the pharmacy, so a practice with Live access changes them only in Live mode, with a Live key or a session in Live mode (403 live_mode_required otherwise). A retry with the same key and body returns the stored first response, even if the practice has changed. Use GET /v1/practices/{practiceId} to read the current practice.
Request example
Replace example values with your Test data. Check the field rules below before you send a request.
{
"externalId": "<string>",
"address": {
"line1": "TX",
"line2": "TX",
"city": "TX",
"state": "TX",
"postalCode": "78701"
},
"liveEnabled": false,
"name": "TX",
"phone": "1234567893"
}
curl -X PATCH 'https://api.affinityrx.com/v1/practices/{practiceId}' \
-H "Authorization: Bearer $AFFINITY_API_KEY" \
-H 'Affinity-Version: 2026-11-01' \
-H 'Idempotency-Key: <Idempotency-Key>' \
-H 'Content-Type: application/json' \
--data @request.json
Response example
These examples show the body structure. Values can differ. Select a status code to see its response.
{
"id": "prac_01j2y8m6jcc9tt24af5pw9x1bc",
"name": "<string>",
"phone": "<string>",
"address": {
"line1": "<string>",
"line2": "<string>",
"city": "<string>",
"state": "<string>",
"postalCode": "<string>"
},
"liveEnabled": false,
"createdAt": "2026-10-28T15:04:05.000Z",
"externalId": "<string>"
}
{
"code": "<string>",
"detail": "<string>",
"title": "<string>",
"type": "<string>",
"issues": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"path": [
"<string>"
]
}
],
"instance": "<string>",
"requestId": "<string>",
"status": 400,
"traceId": "<string>"
}
{
"code": "<string>",
"detail": "<string>",
"title": "<string>",
"type": "<string>",
"issues": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"path": [
"<string>"
]
}
],
"instance": "<string>",
"requestId": "<string>",
"status": 401,
"traceId": "<string>"
}
{
"code": "<string>",
"detail": "<string>",
"title": "<string>",
"type": "<string>",
"issues": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"path": [
"<string>"
]
}
],
"instance": "<string>",
"requestId": "<string>",
"status": 403,
"traceId": "<string>"
}
{
"code": "<string>",
"detail": "<string>",
"title": "<string>",
"type": "<string>",
"issues": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"path": [
"<string>"
]
}
],
"instance": "<string>",
"requestId": "<string>",
"status": 404,
"traceId": "<string>"
}
{
"code": "<string>",
"detail": "<string>",
"title": "<string>",
"type": "<string>",
"issues": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"path": [
"<string>"
]
}
],
"instance": "<string>",
"requestId": "<string>",
"status": 409,
"traceId": "<string>",
"data": {
"orderId": "ord_01j2y8m6jcc9tt24af5pw9x1bc",
"practiceId": "prac_01j2y8m6jcc9tt24af5pw9x1bc"
}
}
{
"code": "<string>",
"detail": "<string>",
"title": "<string>",
"type": "<string>",
"issues": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"path": [
"<string>"
]
}
],
"instance": "<string>",
"requestId": "<string>",
"status": 413,
"traceId": "<string>"
}
{
"code": "unsupported_media_type",
"detail": "<string>",
"title": "<string>",
"type": "<string>",
"instance": "<string>",
"requestId": "<string>",
"status": 415,
"traceId": "<string>"
}
{
"code": "<string>",
"detail": "<string>",
"title": "<string>",
"type": "<string>",
"issues": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"path": [
"<string>"
]
}
],
"instance": "<string>",
"requestId": "<string>",
"status": 422,
"traceId": "<string>"
}
{
"code": "<string>",
"detail": "<string>",
"title": "<string>",
"type": "<string>",
"issues": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"path": [
"<string>"
]
}
],
"instance": "<string>",
"requestId": "<string>",
"status": 429,
"traceId": "<string>",
"data": {
"retryAfterSeconds": 1
}
}
{
"code": "<string>",
"detail": "<string>",
"title": "<string>",
"type": "<string>",
"issues": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"path": [
"<string>"
]
}
],
"instance": "<string>",
"requestId": "<string>",
"status": 500,
"traceId": "<string>"
}
{
"code": "<string>",
"detail": "<string>",
"title": "<string>",
"type": "<string>",
"issues": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"path": [
"<string>"
]
}
],
"instance": "<string>",
"requestId": "<string>",
"status": 503,
"traceId": "<string>"
}
Implementation specification
Use these field types and limits to build your integration. Download the OpenAPI document for the complete contract.
Path parameters
practiceId
string
required
The practice ID.
Pattern: ^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$
Headers
AuthorizationstringFor API key authentication, send Authorization: Bearer <key> with an active API key.
Content-TypestringrequiredSend the JSON body with Content-Type: application/json.
Idempotency-Key
string
required
A unique key per operation, 1 to 255 printable ASCII characters without spaces. Retry the same key and body to avoid repeating the action. The replay response depends on the operation. See https://docs.affinityrx.com/guides/#retry-safely.
Pattern: ^[\x21-\x7e]{1,255}$
Affinity-Version
string
required
The dated API version this request is written against.
Pin requests to 2026-11-01.
Allowed: "2026-11-01"
Default: "2026-11-01"
Request body specification application/json
Send the JSON body with Content-Type: application/json.
externalId
string | null
Your practice identifier, unique among your platform's active practices. Send null to clear it.
Maximum length: 128
Pattern: ^\s*[^\s\x00-\x08\x0a-\x1f\x7f-\x9f](?:[^\x00-\x08\x0a-\x1f\x7f-\x9f]*[^\s\x00-\x08\x0a-\x1f\x7f-\x9f])?\s*$
address
object | null
Affinity merges the address parts you send into the saved address. An omitted part keeps its saved value. To move to an address with no suite, send "line2": null with the new line1, city, state and postalCode. PerfectRx prints it: use Windows-1252 characters, without < or >. Line 1 and line 2 together: 70 characters or fewer.
No additional properties
Show address fields
Any of · 1: object
line1
string
The street address. Line 1 and line 2 together: 70 characters or fewer.
Maximum length: 70
Pattern: ^\s*[\x21-\x3b\x3d\x3f-\x7e\xa1-\xac\xae-\xffŒœŠšŸŽžƒˆ˜̀-̧̃̈̊̌̀́;·`´–—‘-‚“-„†-•…‰‹›€™KÅ](?:[\x09\x20-\x3b\x3d\x3f-\x7e\xa0-\xac\xae-\xffŒœŠšŸŽžƒˆ˜̀-̧̃̈̊̌̀́;·`´–—‘-‚“-„†-•…‰‹›€™KÅ]*[\x21-\x3b\x3d\x3f-\x7e\xa1-\xac\xae-\xffŒœŠšŸŽžƒˆ˜̀-̧̃̈̊̌̀́;·`´–—‘-‚“-„†-•…‰‹›€™KÅ])?\s*$
line2
string | null
The apartment or suite. Send null, empty text, N/A, NA, none or - to remove it. See notes, TBD and unknown return 422. An omitted line2 keeps the saved suite, also when line1 changes.
Maximum length: 70
Pattern: ^\s*(?:[\x21-\x3b\x3d\x3f-\x7e\xa1-\xac\xae-\xffŒœŠšŸŽžƒˆ˜̀-̧̃̈̊̌̀́;·`´–—‘-‚“-„†-•…‰‹›€™KÅ](?:[\x09\x20-\x3b\x3d\x3f-\x7e\xa0-\xac\xae-\xffŒœŠšŸŽžƒˆ˜̀-̧̃̈̊̌̀́;·`´–—‘-‚“-„†-•…‰‹›€™KÅ]*[\x21-\x3b\x3d\x3f-\x7e\xa1-\xac\xae-\xffŒœŠšŸŽžƒˆ˜̀-̧̃̈̊̌̀́;·`´–—‘-‚“-„†-•…‰‹›€™KÅ])?\s*)?$
city
string
The city name.
Maximum length: 100
Pattern: ^\s*[\x21-\x3b\x3d\x3f-\x7e\xa1-\xac\xae-\xffŒœŠšŸŽžƒˆ˜̀-̧̃̈̊̌̀́;·`´–—‘-‚“-„†-•…‰‹›€™KÅ](?:[\x09\x20-\x3b\x3d\x3f-\x7e\xa0-\xac\xae-\xffŒœŠšŸŽžƒˆ˜̀-̧̃̈̊̌̀́;·`´–—‘-‚“-„†-•…‰‹›€™KÅ]*[\x21-\x3b\x3d\x3f-\x7e\xa1-\xac\xae-\xffŒœŠšŸŽžƒˆ˜̀-̧̃̈̊̌̀́;·`´–—‘-‚“-„†-•…‰‹›€™KÅ])?\s*$
state
string
The two-letter code of a US state, DC or PR, in any letter case. Affinity stores and returns it in upper case.
Pattern: ^\s*(?:[Aa][Ll]|[Aa][Kk]|[Aa][Zz]|[Aa][Rr]|[Cc][Aa]|[Cc][Oo]|[Cc][Tt]|[Dd][Ee]|[Dd][Cc]|[Ff][Ll]|[Gg][Aa]|[Hh][Ii]|[Ii][Dd]|[Ii][Ll]|[Ii][Nn]|[Ii][Aa]|[Kk][Ss]|[Kk][Yy]|[Ll][Aa]|[Mm][Ee]|[Mm][Dd]|[Mm][Aa]|[Mm][Ii]|[Mm][Nn]|[Mm][Ss]|[Mm][Oo]|[Mm][Tt]|[Nn][Ee]|[Nn][Vv]|[Nn][Hh]|[Nn][Jj]|[Nn][Mm]|[Nn][Yy]|[Nn][Cc]|[Nn][Dd]|[Oo][Hh]|[Oo][Kk]|[Oo][Rr]|[Pp][Aa]|[Rr][Ii]|[Ss][Cc]|[Ss][Dd]|[Tt][Nn]|[Tt][Xx]|[Uu][Tt]|[Vv][Tt]|[Vv][Aa]|[Ww][Aa]|[Ww][Vv]|[Ww][Ii]|[Ww][Yy]|[Pp][Rr])\s*$
postalCode
string
The US ZIP code: 78701, or ZIP+4 as 78701-1234, 78701 1234 or 787011234. Affinity stores and returns 78701 or 78701-1234.
Pattern: ^\s*\d{5}(?:[ -]?\d{4})?\s*$
Any of · 2: null
null
liveEnabled
boolean | null
Omit it or send null to leave Live unchanged.
name
string
The practice name. PerfectRx prints it: use Windows-1252 characters, without < or >.
Maximum length: 100
Pattern: ^\s*[\x21-\x3b\x3d\x3f-\x7e\xa1-\xac\xae-\xffŒœŠšŸŽžƒˆ˜̀-̧̃̈̊̌̀́;·`´–—‘-‚“-„†-•…‰‹›€™KÅ](?:[\x09\x20-\x3b\x3d\x3f-\x7e\xa0-\xac\xae-\xffŒœŠšŸŽžƒˆ˜̀-̧̃̈̊̌̀́;·`´–—‘-‚“-„†-•…‰‹›€™KÅ]*[\x21-\x3b\x3d\x3f-\x7e\xa1-\xac\xae-\xffŒœŠšŸŽžƒˆ˜̀-̧̃̈̊̌̀́;·`´–—‘-‚“-„†-•…‰‹›€™KÅ])?\s*$
phone
string | null
A US phone number: 10 digits, with or without +1 or 1 before them. Spaces, dashes, dots and parentheses are allowed, such as (512) 555-0100. Affinity stores and returns +15125550100. Empty text counts as null.
Maximum length: 40
Pattern: ^(?:\s*|[\s\x28\x29\x2d\x2e֊־᐀᠆‐‑‒–—―⸗⸚⸺⸻⹀⹝〜〰゠︱︲﹘﹣-𐺭]*(?:\+[\s\x28\x29\x2d\x2e֊־᐀᠆‐‑‒–—―⸗⸚⸺⸻⹀⹝〜〰゠︱︲﹘﹣-𐺭]*1[\s\x28\x29\x2d\x2e֊־᐀᠆‐‑‒–—―⸗⸚⸺⸻⹀⹝〜〰゠︱︲﹘﹣-𐺭]*|1[\s\x28\x29\x2d\x2e֊־᐀᠆‐‑‒–—―⸗⸚⸺⸻⹀⹝〜〰゠︱︲﹘﹣-𐺭]*)?(?:[0-9][\s\x28\x29\x2d\x2e֊־᐀᠆‐‑‒–—―⸗⸚⸺⸻⹀⹝〜〰゠︱︲﹘﹣-𐺭]*){10})$
Response specifications
200 OK
application/json
Practice
id
string
required
The public record identifier.
Pattern: ^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$
name
string
required
The name.
phone
string | null
required
The contact phone number.
address
Address | null
required
The US mailing address.
Show address fields
Any of · 1: Address
line1
string
required
The street address.
line2
string | null
required
The apartment or suite, or null when there is none.
city
string
required
The city name.
state
string
required
The two-letter US state code.
postalCode
string
required
The US ZIP code.
Any of · 2: null
null
liveEnabled
boolean
required
Effective Live access. A managed practice requires both its own Live setting and its platform's Live access.
createdAt
string
required
When the record was created.
Format: date-time
externalId
string | null
required
Your practice identifier, unique among your platform's active practices, or null when unset.
400 Bad Request
application/problem+json
Problem
code
string
required
A stable code for the problem. Branch on it, not on detail.
detail
string
required
What went wrong and what to do, for a person to read.
title
string
required
A short summary of the problem's type.
type
string
required
A URI that names the problem's type.
issues
object[]
One entry for each field that the request got wrong, when the problem is about fields.
Show issues fields
Array items · object
code
string
required
A stable code for this field's problem.
field
string
required
The field as one string, such as patient.address.state or prescriptions[0].quantity.
message
string
required
What is wrong with the field and what to send, for a person to read.
path
string | integer[]
required
The field as a list of property names and array indexes.
Show path fields
Array items · string | integer
string | integer
instance
string
required
The path of the request.
requestId
string
required
Identifies the request, as its X-Request-Id header does. Send it when you report a problem.
status
integer
required
The HTTP status code of the response.
traceId
string
The request trace ID.
401 Unauthorized
application/problem+json
Problem
code
string
required
A stable code for the problem. Branch on it, not on detail.
detail
string
required
What went wrong and what to do, for a person to read.
title
string
required
A short summary of the problem's type.
type
string
required
A URI that names the problem's type.
issues
object[]
One entry for each field that the request got wrong, when the problem is about fields.
Show issues fields
Array items · object
code
string
required
A stable code for this field's problem.
field
string
required
The field as one string, such as patient.address.state or prescriptions[0].quantity.
message
string
required
What is wrong with the field and what to send, for a person to read.
path
string | integer[]
required
The field as a list of property names and array indexes.
Show path fields
Array items · string | integer
string | integer
instance
string
required
The path of the request.
requestId
string
required
Identifies the request, as its X-Request-Id header does. Send it when you report a problem.
status
integer
required
The HTTP status code of the response.
traceId
string
The request trace ID.
403 Forbidden
application/problem+json
Problem
code
string
required
A stable code for the problem. Branch on it, not on detail.
detail
string
required
What went wrong and what to do, for a person to read.
title
string
required
A short summary of the problem's type.
type
string
required
A URI that names the problem's type.
issues
object[]
One entry for each field that the request got wrong, when the problem is about fields.
Show issues fields
Array items · object
code
string
required
A stable code for this field's problem.
field
string
required
The field as one string, such as patient.address.state or prescriptions[0].quantity.
message
string
required
What is wrong with the field and what to send, for a person to read.
path
string | integer[]
required
The field as a list of property names and array indexes.
Show path fields
Array items · string | integer
string | integer
instance
string
required
The path of the request.
requestId
string
required
Identifies the request, as its X-Request-Id header does. Send it when you report a problem.
status
integer
required
The HTTP status code of the response.
traceId
string
The request trace ID.
404 Not Found
application/problem+json
Problem
code
string
required
A stable code for the problem. Branch on it, not on detail.
detail
string
required
What went wrong and what to do, for a person to read.
title
string
required
A short summary of the problem's type.
type
string
required
A URI that names the problem's type.
issues
object[]
One entry for each field that the request got wrong, when the problem is about fields.
Show issues fields
Array items · object
code
string
required
A stable code for this field's problem.
field
string
required
The field as one string, such as patient.address.state or prescriptions[0].quantity.
message
string
required
What is wrong with the field and what to send, for a person to read.
path
string | integer[]
required
The field as a list of property names and array indexes.
Show path fields
Array items · string | integer
string | integer
instance
string
required
The path of the request.
requestId
string
required
Identifies the request, as its X-Request-Id header does. Send it when you report a problem.
status
integer
required
The HTTP status code of the response.
traceId
string
The request trace ID.
409 Conflict
application/problem+json
Problem409
All of · 1: Problem
code
string
required
A stable code for the problem. Branch on it, not on detail.
detail
string
required
What went wrong and what to do, for a person to read.
title
string
required
A short summary of the problem's type.
type
string
required
A URI that names the problem's type.
issues
object[]
One entry for each field that the request got wrong, when the problem is about fields.
Show issues fields
Array items · object
code
string
required
A stable code for this field's problem.
field
string
required
The field as one string, such as patient.address.state or prescriptions[0].quantity.
message
string
required
What is wrong with the field and what to send, for a person to read.
path
string | integer[]
required
The field as a list of property names and array indexes.
Show path fields
Array items · string | integer
string | integer
instance
string
required
The path of the request.
requestId
string
required
Identifies the request, as its X-Request-Id header does. Send it when you report a problem.
status
integer
required
The HTTP status code of the response.
traceId
string
The request trace ID.
All of · 2: object
data
object
Show data fields
orderId
string
Pattern: ^ord_[0-7][0-9a-hjkmnp-tv-z]{25}$
practiceId
string
Pattern: ^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$
413 Content Too Large
application/problem+json
Problem
code
string
required
A stable code for the problem. Branch on it, not on detail.
detail
string
required
What went wrong and what to do, for a person to read.
title
string
required
A short summary of the problem's type.
type
string
required
A URI that names the problem's type.
issues
object[]
One entry for each field that the request got wrong, when the problem is about fields.
Show issues fields
Array items · object
code
string
required
A stable code for this field's problem.
field
string
required
The field as one string, such as patient.address.state or prescriptions[0].quantity.
message
string
required
What is wrong with the field and what to send, for a person to read.
path
string | integer[]
required
The field as a list of property names and array indexes.
Show path fields
Array items · string | integer
string | integer
instance
string
required
The path of the request.
requestId
string
required
Identifies the request, as its X-Request-Id header does. Send it when you report a problem.
status
integer
required
The HTTP status code of the response.
traceId
string
The request trace ID.
415 Unsupported Media Type
application/problem+json
code
"unsupported_media_type"
required
A stable code for the problem. Branch on it, not on detail.
detail
string
required
What went wrong and what to do, for a person to read.
title
string
required
A short summary of the problem's type.
type
string
required
A URI that names the problem's type.
instance
string
required
The path of the request.
requestId
string
required
Identifies the request, as its X-Request-Id header does. Send it when you report a problem.
status
integer
required
The HTTP status code of the response.
traceId
string
The request trace ID.
422 Unprocessable Content
application/problem+json
Problem
code
string
required
A stable code for the problem. Branch on it, not on detail.
detail
string
required
What went wrong and what to do, for a person to read.
title
string
required
A short summary of the problem's type.
type
string
required
A URI that names the problem's type.
issues
object[]
One entry for each field that the request got wrong, when the problem is about fields.
Show issues fields
Array items · object
code
string
required
A stable code for this field's problem.
field
string
required
The field as one string, such as patient.address.state or prescriptions[0].quantity.
message
string
required
What is wrong with the field and what to send, for a person to read.
path
string | integer[]
required
The field as a list of property names and array indexes.
Show path fields
Array items · string | integer
string | integer
instance
string
required
The path of the request.
requestId
string
required
Identifies the request, as its X-Request-Id header does. Send it when you report a problem.
status
integer
required
The HTTP status code of the response.
traceId
string
The request trace ID.
429 Too Many Requests
application/problem+json
Problem429
All of · 1: Problem
code
string
required
A stable code for the problem. Branch on it, not on detail.
detail
string
required
What went wrong and what to do, for a person to read.
title
string
required
A short summary of the problem's type.
type
string
required
A URI that names the problem's type.
issues
object[]
One entry for each field that the request got wrong, when the problem is about fields.
Show issues fields
Array items · object
code
string
required
A stable code for this field's problem.
field
string
required
The field as one string, such as patient.address.state or prescriptions[0].quantity.
message
string
required
What is wrong with the field and what to send, for a person to read.
path
string | integer[]
required
The field as a list of property names and array indexes.
Show path fields
Array items · string | integer
string | integer
instance
string
required
The path of the request.
requestId
string
required
Identifies the request, as its X-Request-Id header does. Send it when you report a problem.
status
integer
required
The HTTP status code of the response.
traceId
string
The request trace ID.
All of · 2: object
data
object
Show data fields
retryAfterSeconds
integer
required
Minimum: 1
Maximum: 9007199254740991
500 Internal Server Error
application/problem+json
Problem
code
string
required
A stable code for the problem. Branch on it, not on detail.
detail
string
required
What went wrong and what to do, for a person to read.
title
string
required
A short summary of the problem's type.
type
string
required
A URI that names the problem's type.
issues
object[]
One entry for each field that the request got wrong, when the problem is about fields.
Show issues fields
Array items · object
code
string
required
A stable code for this field's problem.
field
string
required
The field as one string, such as patient.address.state or prescriptions[0].quantity.
message
string
required
What is wrong with the field and what to send, for a person to read.
path
string | integer[]
required
The field as a list of property names and array indexes.
Show path fields
Array items · string | integer
string | integer
instance
string
required
The path of the request.
requestId
string
required
Identifies the request, as its X-Request-Id header does. Send it when you report a problem.
status
integer
required
The HTTP status code of the response.
traceId
string
The request trace ID.
503 Service Unavailable
application/problem+json
Problem
code
string
required
A stable code for the problem. Branch on it, not on detail.
detail
string
required
What went wrong and what to do, for a person to read.
title
string
required
A short summary of the problem's type.
type
string
required
A URI that names the problem's type.
issues
object[]
One entry for each field that the request got wrong, when the problem is about fields.
Show issues fields
Array items · object
code
string
required
A stable code for this field's problem.
field
string
required
The field as one string, such as patient.address.state or prescriptions[0].quantity.
message
string
required
What is wrong with the field and what to send, for a person to read.
path
string | integer[]
required
The field as a list of property names and array indexes.
Show path fields
Array items · string | integer
string | integer
instance
string
required
The path of the request.
requestId
string
required
Identifies the request, as its X-Request-Id header does. Send it when you report a problem.
status
integer
required
The HTTP status code of the response.
traceId
string
The request trace ID.