Skip to content

List medications

GET /v1/medications

Every medication you can order in the current mode, A to Z by name, then by ID. Send query to find medications by name, ingredient, strength, form or pharmacy. Then choose by name, strength, form and pharmacy. Send practiceId to list what that practice can order, at its prices; without it, the caller's organization is used. Prices are in cents. requirements names the optional prescription fields this pharmacy requires; compoundingReasons and quantities list the accepted values when the pharmacy limits them, counted in quantityUnit. With a fill, price is per fill and each quantity counts quantityUnit, not fills: it is a whole number of fills in units. For a fill of 30 tablets, quantity 60 is two fills. For vials, quantity 1 is one vial and quantity 2 is two vials. A 2 mL vial lists quantities 1–10; its volume is separate from its quantity.

Medications API key authentication Version 2026-11-01

Request example

curl -X GET 'https://api.affinityrx.com/v1/medications' \
  -H "Authorization: Bearer $AFFINITY_API_KEY" \
  -H 'Affinity-Version: 2026-11-01'

Response example

These examples show the body structure. Values can differ. Select a status code to see its response.

{
  "data": [
    {
      "category": "weight_loss",
      "coldChainRequired": false,
      "compoundingReasons": [
        "<string>"
      ],
      "defaultDirections": "<string>",
      "fill": {
        "amount": 1,
        "container": "<string>",
        "ingredients": [
          {
            "amount": 0,
            "name": "<string>",
            "unit": "<string>"
          }
        ],
        "unit": "<string>",
        "volume": {
          "amount": 0,
          "unit": "<string>"
        }
      },
      "form": "<string>",
      "fullName": "<string>",
      "id": "med_01j2y8m6jcc9tt24af5pw9x1bc",
      "kit": {
        "days": 1,
        "vials": [
          {
            "ingredients": [
              {
                "amount": 0,
                "name": "<string>",
                "unit": "<string>"
              }
            ],
            "strength": "<string>"
          }
        ]
      },
      "name": "<string>",
      "pharmacy": {
        "id": "pharm_01j2y8m6jcc9tt24af5pw9x1bc",
        "name": "<string>"
      },
      "pharmacyRank": 0,
      "price": 0,
      "researchUseOnly": false,
      "maxRefills": 0,
      "quantities": [
        1
      ],
      "quantityUnit": "<string>",
      "requirements": [
        "<string>"
      ],
      "restrictedStates": [
        "<string>"
      ],
      "shippingOptions": [
        {
          "id": "shp_01j2y8m6jcc9tt24af5pw9x1bc",
          "name": "<string>",
          "price": 0
        }
      ],
      "shippingSuppliesPrice": 0,
      "strength": "<string>",
      "unsupportedFields": [
        "notes"
      ]
    }
  ],
  "hasMore": false,
  "nextCursor": "<string>",
  "object": "list",
  "url": "<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": 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.

Query parameters

practiceId string

Quote prices and availability for this practice. A platform may select only its own child practices; a practice may select only itself. Omit to use the caller's organization.

Pattern: ^prac_[0-7][0-9a-hjkmnp-tv-z]{25}$

limit integer

Maximum records per page, from 1 to 100. Defaults to 25.

Minimum: 1

Maximum: 100

startingAfter string

Page forward using the previous response's nextCursor. Keep the same filters, sort, organization and mode.

Maximum length: 2048

query string

Find medications that match every word of this text, in any order. Case and accents are ignored. The search reads the name, ingredients, strength, form, route, brands, category and pharmacy name. A word matches the start of a word in this text. A word of letters also matches a part of the name. A word of letters only that matches no word start can have typos: 1 from 4 letters, 2 from 6 letters. A word with a digit, such as a strength or a code, matches only as typed. A word of punctuation alone, such as %, matches only a name that contains it. A medication ID finds that medication. Results stay A to Z by name. An empty query lists every medication. Restart pagination after changing query.

Maximum length: 120

Headers

Authorizationstring

For API key authentication, send Authorization: Bearer <key> with an active API key.

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"

Response specifications

200 OK

application/json

MedicationList

data Medication[] required
Show data fields

Array items · Medication

category string required

What the medication is prescribed for. Every strength, form and pharmacy of one medication has the same category.

Known values: "weight_loss", "hormones", "sexual_health", "hair", "skin", "wellness", "peptides", "pain", "other", "supplies"

coldChainRequired boolean required

Whether the medication requires refrigerated shipping.

compoundingReasons string[] required

The accepted compounding reasons when the pharmacy limits them.

Show compoundingReasons fields

Array items · string

string

defaultDirections string | null required

The catalog's default directions, or null when none are supplied.

fill Fill | null required

What the pharmacy dispenses for one price, or null when the complete fill is unknown.

Show fill fields
Any of · 1: Fill
amount integer required

How much one fill holds, in unit.

Minimum: 1

Maximum: 9007199254740991

container string | null required

What holds one fill, such as vial. Null when the pharmacy does not say.

ingredients object[] required

Each active ingredient's total in one fill: a 2 mL vial of 30 mg/mL is 60 mg.

Show ingredients fields

Array items · object

amount number required

The amount in the specified unit.

name string required

The name.

unit string required

The unit used to measure the amount.

unit string required

The unit of amount, the same as quantityUnit: vial for a vial product.

volume object | null required

What one vial holds, such as 2 mL. Null for a product that is not a vial.

Show volume fields
Any of · 1: object
amount number required

The amount in the specified unit.

unit string required

The unit used to measure the amount.

Any of · 2: null

null

Any of · 2: null

null

form string | null required

The dosage form, or null when it is unknown.

fullName string required

The name with each ingredient: its salt where the catalog records one, such as Enclomiphene Citrate, or the ingredients of a blend named for what prescribers call it, such as Myers' Cocktail. Equals name otherwise.

id string required

The public record identifier.

Pattern: ^med_[0-7][0-9a-hjkmnp-tv-z]{25}$

kit Kit | null required

The vials or bottles a kit holds, in the order they are used; null for anything that is not a kit.

Show kit fields
Any of · 1: Kit
days integer required

How many days the kit lasts.

Minimum: 1

Maximum: 9007199254740991

vials object[] required

Each vial or bottle in the order it is used. fill.volume is what one holds.

Show vials fields

Array items · object

ingredients object[] required

Each active ingredient's total in this vial.

Show ingredients fields

Array items · object

amount number required

The amount in the specified unit.

name string required

The name.

unit string required

The unit used to measure the amount.

strength string required

This vial's strength, such as 5 mg/mL.

Any of · 2: null

null

name string required

The name.

pharmacy PharmacyReference required

The dispensing pharmacy.

Show pharmacy fields
id string required

The public record identifier.

Pattern: ^pharm_[0-7][0-9a-hjkmnp-tv-z]{25}$

name string required

The name.

pharmacyRank integer

Affinity's preference for the dispensing pharmacy, from 0 for the most preferred. When two pharmacies have the same item at the same price, choose the lower rank. Absent when Affinity has no preference for the pharmacy.

Minimum: 0

Maximum: 9007199254740991

price integer required

The price in integer cents.

Minimum: 0

Maximum: 9007199254740991

researchUseOnly boolean required

Whether the medication is for research use only (RUO). Only an organization with RUO access sees one.

maxRefills integer | null required

The most refills a prescription of this medication takes, or null when any count within the request limits is accepted. 0 means the pharmacy takes no refills: send a new order for each fill.

Minimum: 0

Maximum: 9007199254740991

quantities integer[] required

The accepted quantities, counted in quantityUnit; an empty list permits any quantity within the request limits.

Show quantities fields

Array items · integer

integer

Minimum: 1

Maximum: 9007199254740991

quantityUnit string | null required

The unit used to count the prescribed quantity, or null when it is unknown.

requirements string[] required

The optional prescription field paths that this medication requires.

Show requirements fields

Array items · string

string

restrictedStates string[] required

Every state where this medication cannot ship, including states the pharmacy does not cover. It can ship to every other state.

Show restrictedStates fields

Array items · string

string

shippingOptions ShippingOption[] required

The shipping options available for this medication.

Show shippingOptions fields

Array items · ShippingOption

id string required

Shared across Test and Live. Old Test shipping IDs remain valid in Test.

Pattern: ^shp_[0-7][0-9a-hjkmnp-tv-z]{25}$

name string required

The name.

price integer required

The price in integer cents.

Minimum: 0

Maximum: 9007199254740991

shippingSuppliesPrice integer required

Always 0. Each shipping option price is the complete shipping price.

Minimum: 0

Maximum: 9007199254740991

strength string | null required

The pharmacy's strength text, or null when it is unknown.

unsupportedFields string[]

The prescription fields this medication's pharmacy cannot receive: notes (send none) and substitutionPermitted (send true). An order that sets one is still accepted; in Live mode Affinity staff handle it, and in Test mode it fails when sent. Absent when the pharmacy receives them all.

Show unsupportedFields fields

Array items · string

string

Known values: "notes", "substitutionPermitted"

hasMore boolean required
nextCursor string | null required
object string required

Allowed: "list"

url string required
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.

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.

Send feedback

Don't include patient information.

Type to search…

↑↓ navigate ↵ select Esc close