Create Identity Session
curl --request POST \
--url https://api.sandbox.metriport.com/medical/v1/identity/session \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"patientId": "<string>",
"redirectUrl": "<string>",
"metadata": {}
}
'import requests
url = "https://api.sandbox.metriport.com/medical/v1/identity/session"
payload = {
"patientId": "<string>",
"redirectUrl": "<string>",
"metadata": {}
}
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({patientId: '<string>', redirectUrl: '<string>', metadata: {}})
};
fetch('https://api.sandbox.metriport.com/medical/v1/identity/session', 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/identity/session",
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([
'patientId' => '<string>',
'redirectUrl' => '<string>',
'metadata' => [
]
]),
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/identity/session"
payload := strings.NewReader("{\n \"patientId\": \"<string>\",\n \"redirectUrl\": \"<string>\",\n \"metadata\": {}\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/identity/session")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"patientId\": \"<string>\",\n \"redirectUrl\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.metriport.com/medical/v1/identity/session")
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 \"patientId\": \"<string>\",\n \"redirectUrl\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"sessionId": "<string>",
"sessionUrl": "<string>",
"expiresAt": "<string>",
"status": "<string>"
}IAS
Create Identity Session
Starts a hosted identity verification session for a user.
POST
/
medical
/
v1
/
identity
/
session
Create Identity Session
curl --request POST \
--url https://api.sandbox.metriport.com/medical/v1/identity/session \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"patientId": "<string>",
"redirectUrl": "<string>",
"metadata": {}
}
'import requests
url = "https://api.sandbox.metriport.com/medical/v1/identity/session"
payload = {
"patientId": "<string>",
"redirectUrl": "<string>",
"metadata": {}
}
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({patientId: '<string>', redirectUrl: '<string>', metadata: {}})
};
fetch('https://api.sandbox.metriport.com/medical/v1/identity/session', 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/identity/session",
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([
'patientId' => '<string>',
'redirectUrl' => '<string>',
'metadata' => [
]
]),
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/identity/session"
payload := strings.NewReader("{\n \"patientId\": \"<string>\",\n \"redirectUrl\": \"<string>\",\n \"metadata\": {}\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/identity/session")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"patientId\": \"<string>\",\n \"redirectUrl\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.metriport.com/medical/v1/identity/session")
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 \"patientId\": \"<string>\",\n \"redirectUrl\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"sessionId": "<string>",
"sessionUrl": "<string>",
"expiresAt": "<string>",
"status": "<string>"
}Returns a single-use URL where the user completes IAL2 identity verification with an approved
Credential Service Provider. When verification finishes, Metriport sends an
ias.identity.verified webhook with a
proofedIdentityId you pass on subsequent IAS-purposed queries.
Body
string
required
The Metriport patient the verified identity will be
attached to.
string
required
HTTPS URL where Metriport sends the user after the
session. Must be on your account’s allowlist.
object
Up to 50 string key/value pairs. Returned on subsequent
webhook events.
Response
string
required
Unique identifier for this identity session.
string
required
The URL to redirect the user to. Single-use.
string
required
ISO-8601 timestamp when the session URL expires.
string
required
pending on creation. Reaches completed or expired.Response
{
"sessionId": "ids_018f7c2f...",
"sessionUrl": "https://auth.ias.metriport.com/s/eyJhbGciOi...",
"expiresAt": "2026-04-29T14:52:11.000Z",
"status": "pending"
}
⌘I

