Send Message
curl --request POST \
--url https://api.sandbox.metriport.com/medical/v1/message \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"destination": "<string>",
"subject": "<string>",
"body": "<string>",
"attachments": [
"<string>"
],
"intendedRecipientNpi": [
"<string>"
]
}
'import requests
url = "https://api.sandbox.metriport.com/medical/v1/message"
payload = {
"destination": "<string>",
"subject": "<string>",
"body": "<string>",
"attachments": ["<string>"],
"intendedRecipientNpi": ["<string>"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
destination: '<string>',
subject: '<string>',
body: JSON.stringify('<string>'),
attachments: ['<string>'],
intendedRecipientNpi: ['<string>']
})
};
fetch('https://api.sandbox.metriport.com/medical/v1/message', 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.metriport.com/medical/v1/message",
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([
'destination' => '<string>',
'subject' => '<string>',
'body' => '<string>',
'attachments' => [
'<string>'
],
'intendedRecipientNpi' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.metriport.com/medical/v1/message"
payload := strings.NewReader("{\n \"destination\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"attachments\": [\n \"<string>\"\n ],\n \"intendedRecipientNpi\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.metriport.com/medical/v1/message")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"destination\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"attachments\": [\n \"<string>\"\n ],\n \"intendedRecipientNpi\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.metriport.com/medical/v1/message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"destination\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"attachments\": [\n \"<string>\"\n ],\n \"intendedRecipientNpi\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_bodyimport { MetriportMedicalApi } from "@metriport/api-sdk";
const metriport = new MetriportMedicalApi("YOUR_API_KEY");
const message = await metriport.sendMessage({
patientId: "11111111-1111-1111-1111-111111111111",
destination: "2.16.840.1.113883.3.666.123.4.101",
subject: "Referral - cardiology",
body: "Please review the attached referral for cardiology consultation.",
attachments: ["00000000-0000-0000-0000-000000000000"],
intendedRecipientNpi: ["1234567890"],
});
Message
Send Message
Send a message to another practitioner
POST
/
medical
/
v1
/
message
Send Message
curl --request POST \
--url https://api.sandbox.metriport.com/medical/v1/message \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"destination": "<string>",
"subject": "<string>",
"body": "<string>",
"attachments": [
"<string>"
],
"intendedRecipientNpi": [
"<string>"
]
}
'import requests
url = "https://api.sandbox.metriport.com/medical/v1/message"
payload = {
"destination": "<string>",
"subject": "<string>",
"body": "<string>",
"attachments": ["<string>"],
"intendedRecipientNpi": ["<string>"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
destination: '<string>',
subject: '<string>',
body: JSON.stringify('<string>'),
attachments: ['<string>'],
intendedRecipientNpi: ['<string>']
})
};
fetch('https://api.sandbox.metriport.com/medical/v1/message', 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.metriport.com/medical/v1/message",
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([
'destination' => '<string>',
'subject' => '<string>',
'body' => '<string>',
'attachments' => [
'<string>'
],
'intendedRecipientNpi' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.metriport.com/medical/v1/message"
payload := strings.NewReader("{\n \"destination\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"attachments\": [\n \"<string>\"\n ],\n \"intendedRecipientNpi\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.metriport.com/medical/v1/message")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"destination\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"attachments\": [\n \"<string>\"\n ],\n \"intendedRecipientNpi\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.metriport.com/medical/v1/message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"destination\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"attachments\": [\n \"<string>\"\n ],\n \"intendedRecipientNpi\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_bodyimport { MetriportMedicalApi } from "@metriport/api-sdk";
const metriport = new MetriportMedicalApi("YOUR_API_KEY");
const message = await metriport.sendMessage({
patientId: "11111111-1111-1111-1111-111111111111",
destination: "2.16.840.1.113883.3.666.123.4.101",
subject: "Referral - cardiology",
body: "Please review the attached referral for cardiology consultation.",
attachments: ["00000000-0000-0000-0000-000000000000"],
intendedRecipientNpi: ["1234567890"],
});
This endpoint is currently under construction. Please
reach out to support if you'd like to use it.
processing.
The id can be used to Get Message Status. When the recipient acknowledges receipt, or if delivery fails, a webhook request will be sent to your configured URL:
message.status: can be one ofcompletedorfailed, depending on the outcome of the operation.
See the Message Delivery
guide for
the explanation of the full flow.
Query Params
string
required
The ID of the Patient the message relates to.
Body
string
required
Where to deliver the message. Use List Network
Entries with
supportsMessaging=true to find a value, or pass one you already have. Can
be an OID, or an email address.string
required
The subject of the message. Think of it as the subject
field in an email.
string
Plain-text content of the message. At least one of
body
or attachments is required.string[]
Document IDs that have already been uploaded to Metriport
to attach to the message. At least one of
body or
attachments is required.string[]
Optional NPIs of the intended recipients. Useful when
destination identifies an organization but the message
is intended for specific practitioners.{
"destination": "2.16.840.1.113883.3.666.123.4.101",
"subject": "Referral - cardiology",
"body": "Please review the attached referral for cardiology consultation.",
"attachments": [
"00000000-0000-0000-0000-000000000000"
],
"intendedRecipientNpi": [
"1234567890"
]
}
Response
Returns the Message at the top level (not wrapped).string
required
The ID of the message.
string
required
The ID of the Patient the message relates to.
string
required
One of
outbound or inbound.string
required
The delivery status. One of
processing, completed, or failed.string
required
How the message is transported. One of
xdr or direct.string
The network used for XDR delivery. One of
EHEX, CAREQUALITY, or
COMMONWELL. Required when transportMethod is xdr.string
required
Where the message is delivered. An OID or a Direct email address.
string
required
The subject of the message.
string
Plain-text content of the message, when present.
string[]
Document IDs attached to the message, when present.
string[]
Intended recipient NPIs, when present.
string
required
ISO 8601 timestamp of when the message was created / accepted for send.
string
required
ISO 8601 timestamp of the latest status update.
string
Failure reason. Only present when
status is failed.{
"id": "00000000-0000-0000-0000-000000000000",
"patientId": "11111111-1111-1111-1111-111111111111",
"direction": "outbound",
"status": "processing",
"transportMethod": "xdr",
"network": "EHEX",
"destination": "2.16.840.1.113883.3.666.123.4.101",
"subject": "Referral - cardiology",
"body": "Please review the attached referral for cardiology consultation.",
"attachments": ["00000000-0000-0000-0000-000000000000"],
"intendedRecipientNpi": ["1234567890"],
"sentAt": "2026-06-16T18:40:00.000Z",
"updatedAt": "2026-06-16T18:40:00.000Z"
}
import { MetriportMedicalApi } from "@metriport/api-sdk";
const metriport = new MetriportMedicalApi("YOUR_API_KEY");
const message = await metriport.sendMessage({
patientId: "11111111-1111-1111-1111-111111111111",
destination: "2.16.840.1.113883.3.666.123.4.101",
subject: "Referral - cardiology",
body: "Please review the attached referral for cardiology consultation.",
attachments: ["00000000-0000-0000-0000-000000000000"],
intendedRecipientNpi: ["1234567890"],
});

