Custom Drug Endpoints
Create custom drug
Creates a user-level custom drug for a user in Parchment
POST
/
v1
/
organizations
/
{organization_id}
/
users
/
{user_id}
/
custom-drugs
cURL
curl --request POST \
--url https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/users/{user_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": "<string>",
"item_trade_name": "<string>",
"brand_name": "<string>",
"custom_product_id": "<string>",
"description": "<string>",
"patient_instructions": "<string>",
"doctor_instructions": "<string>"
}
'import requests
url = "https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/users/{user_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": "<string>",
"item_trade_name": "<string>",
"brand_name": "<string>",
"custom_product_id": "<string>",
"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: '<string>',
item_trade_name: '<string>',
brand_name: '<string>',
custom_product_id: '<string>',
description: '<string>',
patient_instructions: '<string>',
doctor_instructions: '<string>'
})
};
fetch('https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/users/{user_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}/users/{user_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' => '<string>',
'item_trade_name' => '<string>',
'brand_name' => '<string>',
'custom_product_id' => '<string>',
'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}/users/{user_id}/custom-drugs"
payload := strings.NewReader("{\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\": \"<string>\",\n \"item_trade_name\": \"<string>\",\n \"brand_name\": \"<string>\",\n \"custom_product_id\": \"<string>\",\n \"description\": \"<string>\",\n \"patient_instructions\": \"<string>\",\n \"doctor_instructions\": \"<string>\"\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}/users/{user_id}/custom-drugs")
.header("x-organization-secret", "<x-organization-secret>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\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\": \"<string>\",\n \"item_trade_name\": \"<string>\",\n \"brand_name\": \"<string>\",\n \"custom_product_id\": \"<string>\",\n \"description\": \"<string>\",\n \"patient_instructions\": \"<string>\",\n \"doctor_instructions\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/users/{user_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 \"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\": \"<string>\",\n \"item_trade_name\": \"<string>\",\n \"brand_name\": \"<string>\",\n \"custom_product_id\": \"<string>\",\n \"description\": \"<string>\",\n \"patient_instructions\": \"<string>\",\n \"doctor_instructions\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"statusCode": 123,
"message": "<string>",
"code": "SUCCESS",
"data": {
"custom_drug_id": "<string>",
"item_generic_name": "<string>",
"item_trade_name": "<string>",
"brand_name": "<string>",
"item_strength": "<string>",
"item_form": "<string>",
"route_of_administration": "<string>",
"quantity": "<string>",
"max_repeats": "<string>",
"poison_class": "<string>",
"custom_product_id": "<string>",
"description": "<string>",
"patient_instructions": "<string>",
"doctor_instructions": "<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 a user-level custom drug for the given user (stored against
USER#{user_id}).
Integration Notes
- Scope Requirement: Your API token must include the
create:custom_drugscope. - Level: This endpoint always creates user-level drugs. Use the bulk endpoint to manage the organization-level catalog.
- Response: Returns the created drug, including its
custom_drug_id(use it to update/delete the drug or to prefill the prescription form). - Validation:
item_generic_name,item_strength,item_form,route_of_administration,quantity,poison_class, andmax_repeatsare required.
Example Request
{
"item_generic_name": "Amoxicillin",
"item_strength": "500mg",
"item_form": "Capsule",
"route_of_administration": "Oral",
"quantity": "20",
"max_repeats": "2",
"poison_class": "S4",
"brand_name": "Amoxil",
"patient_instructions": "Take one capsule twice daily"
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Organization secret for authentication - provided by Parchment
Body
application/json
Custom drug to create
Custom drug fields supplied by a partner when creating a drug.
Maximum string length:
280Maximum string length:
100Maximum string length:
50Maximum string length:
50String or number; coerced to string
String or number; coerced to string
Maximum string length:
2Maximum string length:
280Maximum string length:
100Maximum string length:
50Maximum string length:
280Maximum string length:
250Maximum string length:
50Was this page helpful?
Previous
Read custom drugsRetrieves the custom drug list (organization-level and user-level) for a user from Parchment
Next
⌘I
cURL
curl --request POST \
--url https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/users/{user_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": "<string>",
"item_trade_name": "<string>",
"brand_name": "<string>",
"custom_product_id": "<string>",
"description": "<string>",
"patient_instructions": "<string>",
"doctor_instructions": "<string>"
}
'import requests
url = "https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/users/{user_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": "<string>",
"item_trade_name": "<string>",
"brand_name": "<string>",
"custom_product_id": "<string>",
"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: '<string>',
item_trade_name: '<string>',
brand_name: '<string>',
custom_product_id: '<string>',
description: '<string>',
patient_instructions: '<string>',
doctor_instructions: '<string>'
})
};
fetch('https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/users/{user_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}/users/{user_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' => '<string>',
'item_trade_name' => '<string>',
'brand_name' => '<string>',
'custom_product_id' => '<string>',
'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}/users/{user_id}/custom-drugs"
payload := strings.NewReader("{\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\": \"<string>\",\n \"item_trade_name\": \"<string>\",\n \"brand_name\": \"<string>\",\n \"custom_product_id\": \"<string>\",\n \"description\": \"<string>\",\n \"patient_instructions\": \"<string>\",\n \"doctor_instructions\": \"<string>\"\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}/users/{user_id}/custom-drugs")
.header("x-organization-secret", "<x-organization-secret>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\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\": \"<string>\",\n \"item_trade_name\": \"<string>\",\n \"brand_name\": \"<string>\",\n \"custom_product_id\": \"<string>\",\n \"description\": \"<string>\",\n \"patient_instructions\": \"<string>\",\n \"doctor_instructions\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.parchmenthealth.io/external/v1/organizations/{organization_id}/users/{user_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 \"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\": \"<string>\",\n \"item_trade_name\": \"<string>\",\n \"brand_name\": \"<string>\",\n \"custom_product_id\": \"<string>\",\n \"description\": \"<string>\",\n \"patient_instructions\": \"<string>\",\n \"doctor_instructions\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"statusCode": 123,
"message": "<string>",
"code": "SUCCESS",
"data": {
"custom_drug_id": "<string>",
"item_generic_name": "<string>",
"item_trade_name": "<string>",
"brand_name": "<string>",
"item_strength": "<string>",
"item_form": "<string>",
"route_of_administration": "<string>",
"quantity": "<string>",
"max_repeats": "<string>",
"poison_class": "<string>",
"custom_product_id": "<string>",
"description": "<string>",
"patient_instructions": "<string>",
"doctor_instructions": "<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"
}
}
