Custom Drug Endpoints
Create custom drugs bulk
Bulk-creates organization-level custom drugs. Accepts a JSON array; returns a per-item success/failure summary.
POST
/
v1
/
organizations
/
{organization_id}
/
custom-drugs
cURL
curl --request POST \
--url https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/custom-drugs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-organization-secret: <x-organization-secret>' \
--data '
[
{
"item_generic_name": "<string>",
"item_strength": "<string>",
"item_form": "<string>",
"route_of_administration": "<string>",
"quantity": "<string>",
"max_repeats": "<string>",
"poison_class": "S4",
"item_trade_name": "<string>",
"brand_name": "<string>",
"custom_product_id": "EK-12345",
"description": "<string>",
"patient_instructions": "<string>",
"doctor_instructions": "<string>"
}
]
'import requests
url = "https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/custom-drugs"
payload = [
{
"item_generic_name": "<string>",
"item_strength": "<string>",
"item_form": "<string>",
"route_of_administration": "<string>",
"quantity": "<string>",
"max_repeats": "<string>",
"poison_class": "S4",
"item_trade_name": "<string>",
"brand_name": "<string>",
"custom_product_id": "EK-12345",
"description": "<string>",
"patient_instructions": "<string>",
"doctor_instructions": "<string>"
}
]
headers = {
"x-organization-secret": "<x-organization-secret>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-organization-secret': '<x-organization-secret>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify([
{
item_generic_name: '<string>',
item_strength: '<string>',
item_form: '<string>',
route_of_administration: '<string>',
quantity: '<string>',
max_repeats: '<string>',
poison_class: 'S4',
item_trade_name: '<string>',
brand_name: '<string>',
custom_product_id: 'EK-12345',
description: '<string>',
patient_instructions: '<string>',
doctor_instructions: '<string>'
}
])
};
fetch('https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/custom-drugs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/custom-drugs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'item_generic_name' => '<string>',
'item_strength' => '<string>',
'item_form' => '<string>',
'route_of_administration' => '<string>',
'quantity' => '<string>',
'max_repeats' => '<string>',
'poison_class' => 'S4',
'item_trade_name' => '<string>',
'brand_name' => '<string>',
'custom_product_id' => 'EK-12345',
'description' => '<string>',
'patient_instructions' => '<string>',
'doctor_instructions' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-organization-secret: <x-organization-secret>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/custom-drugs"
payload := strings.NewReader("[\n {\n \"item_generic_name\": \"<string>\",\n \"item_strength\": \"<string>\",\n \"item_form\": \"<string>\",\n \"route_of_administration\": \"<string>\",\n \"quantity\": \"<string>\",\n \"max_repeats\": \"<string>\",\n \"poison_class\": \"S4\",\n \"item_trade_name\": \"<string>\",\n \"brand_name\": \"<string>\",\n \"custom_product_id\": \"EK-12345\",\n \"description\": \"<string>\",\n \"patient_instructions\": \"<string>\",\n \"doctor_instructions\": \"<string>\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-organization-secret", "<x-organization-secret>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/custom-drugs")
.header("x-organization-secret", "<x-organization-secret>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"item_generic_name\": \"<string>\",\n \"item_strength\": \"<string>\",\n \"item_form\": \"<string>\",\n \"route_of_administration\": \"<string>\",\n \"quantity\": \"<string>\",\n \"max_repeats\": \"<string>\",\n \"poison_class\": \"S4\",\n \"item_trade_name\": \"<string>\",\n \"brand_name\": \"<string>\",\n \"custom_product_id\": \"EK-12345\",\n \"description\": \"<string>\",\n \"patient_instructions\": \"<string>\",\n \"doctor_instructions\": \"<string>\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/custom-drugs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-organization-secret"] = '<x-organization-secret>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"item_generic_name\": \"<string>\",\n \"item_strength\": \"<string>\",\n \"item_form\": \"<string>\",\n \"route_of_administration\": \"<string>\",\n \"quantity\": \"<string>\",\n \"max_repeats\": \"<string>\",\n \"poison_class\": \"S4\",\n \"item_trade_name\": \"<string>\",\n \"brand_name\": \"<string>\",\n \"custom_product_id\": \"EK-12345\",\n \"description\": \"<string>\",\n \"patient_instructions\": \"<string>\",\n \"doctor_instructions\": \"<string>\"\n }\n]"
response = http.request(request)
puts response.read_body{
"success": true,
"statusCode": 123,
"message": "<string>",
"code": "SUCCESS",
"data": {
"total": 123,
"successCount": 123,
"failureCount": 123,
"failures": [
{
"index": 123,
"error": "<string>"
}
],
"created": [
{
"index": 123,
"custom_drug_id": "<string>",
"custom_product_id": "<string>"
}
]
},
"timestamp": "<string>",
"requestId": "<string>"
}{
"success": false,
"statusCode": 400,
"error": {
"type": "https://parchment.health/errors/validation-error",
"title": "Validation failed",
"detail": "There were some problems with your input.",
"instance": "/patients/123",
"validation": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
},
"timestamp": "2024-01-15T10:30:00.000Z",
"requestId": "req_1705312200000_def456",
"code": "RESOURCE_NOT_FOUND",
"meta": {
"apiVersion": "1.0"
}
}{
"success": false,
"statusCode": 400,
"error": {
"type": "https://parchment.health/errors/validation-error",
"title": "Validation failed",
"detail": "There were some problems with your input.",
"instance": "/patients/123",
"validation": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
},
"timestamp": "2024-01-15T10:30:00.000Z",
"requestId": "req_1705312200000_def456",
"code": "RESOURCE_NOT_FOUND",
"meta": {
"apiVersion": "1.0"
}
}{
"success": false,
"statusCode": 400,
"error": {
"type": "https://parchment.health/errors/validation-error",
"title": "Validation failed",
"detail": "There were some problems with your input.",
"instance": "/patients/123",
"validation": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
},
"timestamp": "2024-01-15T10:30:00.000Z",
"requestId": "req_1705312200000_def456",
"code": "RESOURCE_NOT_FOUND",
"meta": {
"apiVersion": "1.0"
}
}Creates organization-level custom drugs. Send a JSON array; a single drug is a one-element array. Each item is processed on its own, so one bad item does not block the rest.
created[] returns the custom_drug_id of every drug created, with your custom_product_id echoed back. Store it: it is the id for the per-item update and delete endpoints.
Example Request
[
{
"item_generic_name": "Amoxicillin",
"item_strength": "500mg",
"item_form": "Capsule",
"route_of_administration": "Oral",
"quantity": "20",
"max_repeats": "2",
"poison_class": "S4",
"custom_product_id": "EK-12345"
},
{
"item_generic_name": "Ibuprofen",
"item_strength": "200mg",
"item_form": "Tablet",
"route_of_administration": "Oral",
"quantity": "30",
"max_repeats": "1",
"poison_class": "S2",
"custom_product_id": "EK-12346"
}
]
Example Response
{
"success": true,
"statusCode": 200,
"message": "Created 2 of 2 custom drugs successfully",
"code": "SUCCESS",
"data": {
"total": 2,
"successCount": 2,
"failureCount": 0,
"failures": [],
"created": [
{ "index": 1, "custom_drug_id": "3b99ce35-844c-4925-93ff-5b8ec13be5f5", "custom_product_id": "EK-12345" },
{ "index": 2, "custom_drug_id": "9f5dec76-d438-4aea-a6a1-173d8efb5377", "custom_product_id": "EK-12346" }
]
},
"timestamp": "2024-01-25T09:15:00.000Z",
"requestId": "req_1706171700000_abc123"
}
Field Rules
| Field | Rule |
|---|---|
custom_product_id | Optional, max 50 characters. Your own id; Parchment never generates it and does not check uniqueness |
poison_class | S2 to S9 with the S prefix. A bare digit such as 5 is rejected |
quantity, max_repeats | String or number; stored as string. max_repeats 0 to 99 |
Status Codes
| Code | Meaning |
|---|---|
| 200 | At least one item created — read failures for the rest |
| 400 | Body is not a non-empty array, or every item failed |
| 401 | Authentication failed, or the token’s user is not an organization owner or admin |
| 500 | Unexpected server error |
Notes
- Requires the
create:custom_drugscope. failureslists the first 50 failed items with their 1-basedindex.- Use the user-level create endpoint for a prescriber’s personal drug.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Organization secret for authentication - provided by Parchment
Path Parameters
Organization ID
Body
application/json
Non-empty array of custom drugs to create at organization level
Maximum string length:
280Maximum string length:
100Maximum string length:
50Maximum string length:
50String or number; coerced to string
String or number; coerced to string
Schedule with the S prefix, S2 to S9. A bare digit is rejected.
Maximum string length:
2Pattern:
^S[2-9]$Example:
"S4"
Maximum string length:
280Maximum string length:
100Your own identifier for this drug. Never generated by Parchment. Not checked for uniqueness.
Maximum string length:
50Example:
"EK-12345"
Maximum string length:
280Maximum string length:
250Maximum string length:
50Was this page helpful?
⌘I
cURL
curl --request POST \
--url https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/custom-drugs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-organization-secret: <x-organization-secret>' \
--data '
[
{
"item_generic_name": "<string>",
"item_strength": "<string>",
"item_form": "<string>",
"route_of_administration": "<string>",
"quantity": "<string>",
"max_repeats": "<string>",
"poison_class": "S4",
"item_trade_name": "<string>",
"brand_name": "<string>",
"custom_product_id": "EK-12345",
"description": "<string>",
"patient_instructions": "<string>",
"doctor_instructions": "<string>"
}
]
'import requests
url = "https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/custom-drugs"
payload = [
{
"item_generic_name": "<string>",
"item_strength": "<string>",
"item_form": "<string>",
"route_of_administration": "<string>",
"quantity": "<string>",
"max_repeats": "<string>",
"poison_class": "S4",
"item_trade_name": "<string>",
"brand_name": "<string>",
"custom_product_id": "EK-12345",
"description": "<string>",
"patient_instructions": "<string>",
"doctor_instructions": "<string>"
}
]
headers = {
"x-organization-secret": "<x-organization-secret>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-organization-secret': '<x-organization-secret>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify([
{
item_generic_name: '<string>',
item_strength: '<string>',
item_form: '<string>',
route_of_administration: '<string>',
quantity: '<string>',
max_repeats: '<string>',
poison_class: 'S4',
item_trade_name: '<string>',
brand_name: '<string>',
custom_product_id: 'EK-12345',
description: '<string>',
patient_instructions: '<string>',
doctor_instructions: '<string>'
}
])
};
fetch('https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/custom-drugs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/custom-drugs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'item_generic_name' => '<string>',
'item_strength' => '<string>',
'item_form' => '<string>',
'route_of_administration' => '<string>',
'quantity' => '<string>',
'max_repeats' => '<string>',
'poison_class' => 'S4',
'item_trade_name' => '<string>',
'brand_name' => '<string>',
'custom_product_id' => 'EK-12345',
'description' => '<string>',
'patient_instructions' => '<string>',
'doctor_instructions' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-organization-secret: <x-organization-secret>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/custom-drugs"
payload := strings.NewReader("[\n {\n \"item_generic_name\": \"<string>\",\n \"item_strength\": \"<string>\",\n \"item_form\": \"<string>\",\n \"route_of_administration\": \"<string>\",\n \"quantity\": \"<string>\",\n \"max_repeats\": \"<string>\",\n \"poison_class\": \"S4\",\n \"item_trade_name\": \"<string>\",\n \"brand_name\": \"<string>\",\n \"custom_product_id\": \"EK-12345\",\n \"description\": \"<string>\",\n \"patient_instructions\": \"<string>\",\n \"doctor_instructions\": \"<string>\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-organization-secret", "<x-organization-secret>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/custom-drugs")
.header("x-organization-secret", "<x-organization-secret>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"item_generic_name\": \"<string>\",\n \"item_strength\": \"<string>\",\n \"item_form\": \"<string>\",\n \"route_of_administration\": \"<string>\",\n \"quantity\": \"<string>\",\n \"max_repeats\": \"<string>\",\n \"poison_class\": \"S4\",\n \"item_trade_name\": \"<string>\",\n \"brand_name\": \"<string>\",\n \"custom_product_id\": \"EK-12345\",\n \"description\": \"<string>\",\n \"patient_instructions\": \"<string>\",\n \"doctor_instructions\": \"<string>\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/custom-drugs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-organization-secret"] = '<x-organization-secret>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"item_generic_name\": \"<string>\",\n \"item_strength\": \"<string>\",\n \"item_form\": \"<string>\",\n \"route_of_administration\": \"<string>\",\n \"quantity\": \"<string>\",\n \"max_repeats\": \"<string>\",\n \"poison_class\": \"S4\",\n \"item_trade_name\": \"<string>\",\n \"brand_name\": \"<string>\",\n \"custom_product_id\": \"EK-12345\",\n \"description\": \"<string>\",\n \"patient_instructions\": \"<string>\",\n \"doctor_instructions\": \"<string>\"\n }\n]"
response = http.request(request)
puts response.read_body{
"success": true,
"statusCode": 123,
"message": "<string>",
"code": "SUCCESS",
"data": {
"total": 123,
"successCount": 123,
"failureCount": 123,
"failures": [
{
"index": 123,
"error": "<string>"
}
],
"created": [
{
"index": 123,
"custom_drug_id": "<string>",
"custom_product_id": "<string>"
}
]
},
"timestamp": "<string>",
"requestId": "<string>"
}{
"success": false,
"statusCode": 400,
"error": {
"type": "https://parchment.health/errors/validation-error",
"title": "Validation failed",
"detail": "There were some problems with your input.",
"instance": "/patients/123",
"validation": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
},
"timestamp": "2024-01-15T10:30:00.000Z",
"requestId": "req_1705312200000_def456",
"code": "RESOURCE_NOT_FOUND",
"meta": {
"apiVersion": "1.0"
}
}{
"success": false,
"statusCode": 400,
"error": {
"type": "https://parchment.health/errors/validation-error",
"title": "Validation failed",
"detail": "There were some problems with your input.",
"instance": "/patients/123",
"validation": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
},
"timestamp": "2024-01-15T10:30:00.000Z",
"requestId": "req_1705312200000_def456",
"code": "RESOURCE_NOT_FOUND",
"meta": {
"apiVersion": "1.0"
}
}{
"success": false,
"statusCode": 400,
"error": {
"type": "https://parchment.health/errors/validation-error",
"title": "Validation failed",
"detail": "There were some problems with your input.",
"instance": "/patients/123",
"validation": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
},
"timestamp": "2024-01-15T10:30:00.000Z",
"requestId": "req_1705312200000_def456",
"code": "RESOURCE_NOT_FOUND",
"meta": {
"apiVersion": "1.0"
}
}
