Skip to main content
POST
/
v1
/
organizations
/
{organization_id}
/
users
/
{user_id}
/
patients
cURL
curl --request POST \
  --url https://api.dev.parchmenthealth.io/external/v1/organizations/{organization_id}/users/{user_id}/patients \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-organization-secret: <x-organization-secret>' \
  --data '
{
  "given_name": "<string>",
  "family_name": "<string>",
  "date_of_birth": "2023-12-25",
  "sex": "M",
  "partner_patient_id": "<string>",
  "dva_file_number": "<string>",
  "medicare_card_number": "<string>",
  "medicare_irn": "<string>",
  "email": "[email protected]",
  "phone": "<string>",
  "australian_street_address": {
    "street_number": "<string>",
    "street_name": "<string>",
    "suburb": "<string>",
    "state": "NSW",
    "postcode": "<string>"
  },
  "medicare_valid_to": "2023-12-25",
  "concession_pension_number": "<string>",
  "entitlement_number": "<string>",
  "dva_card_color": "gold",
  "racf_id": "<string>",
  "ctg_eligible": true,
  "indigenous_type": "aboriginal",
  "partner_id": "<string>"
}
'
{
  "success": true,
  "statusCode": 201,
  "message": "Patient created successfully",
  "data": {
    "external_patient_id": "PARTNER#12345",
    "parchment_patient_id": "pat_abc123def456",
    "url": "https://app.parchment.health/dashboard/patients/pat_abc123def456"
  },
  "timestamp": "2024-01-15T10:30:00.000Z",
  "requestId": "req_1705312200000_abc123"
}

Response Examples

Success Response (201 Created)

{
  "success": true,
  "statusCode": 201,
  "message": "Patient created successfully",
  "data": {
    "external_patient_id": "CLINIKO#12345",
    "parchment_patient_id": "pat_abc123def456",
    "url": "https://app.parchment.health/dashboard/patients/pat_abc123def456"
  },
  "timestamp": "2024-01-15T10:30:00.000Z",
  "requestId": "req_1705312200000_abc123"
}

Conflict Detected (202 Accepted)

{
  "success": true,
  "statusCode": 202,
  "message": "Patient creation accepted - conflicts found",
  "data": {
    "external_patient_id": "CLINIKO#12345",
    "parchment_patient_id": "pat_existing789",
    "url": "https://app.parchment.health/dashboard/patients/pat_existing789"
  },
  "timestamp": "2024-01-15T10:30:00.000Z",
  "requestId": "req_1705312200000_def456"
}

Validation Error (422 Unprocessable Entity)

{
  "success": false,
  "statusCode": 422,
  "error": {
    "type": "https://parchment.health/errors/validation-error",
    "title": "Validation failed",
    "detail": "There were some problems with your input.",
    "validation": [
      {
        "field": "family_name",
        "message": "Family name cannot be empty",
        "code": "VALIDATION_ERROR"
      },
      {
        "field": "given_name",
        "message": "Given name cannot be empty",
        "code": "VALIDATION_ERROR"
      },
      {
        "field": "phone",
        "message": "Phone number must be a valid Australian number (e.g., 0412345678, +61412345678)",
        "code": "INVALID_FORMAT"
      },
      {
        "field": "postcode",
        "message": "Postcode must be 4 digits",
        "code": "INVALID_FORMAT"
      }
    ]
  },
  "timestamp": "2024-01-15T10:30:00.000Z",
  "requestId": "req_1705312200000_ghi789"
}

Partner Patient ID Conflict (409 Conflict)

{
  "success": false,
  "statusCode": 409,
  "error": {
    "type": "https://parchment.health/errors/partner-patient-id-conflict",
    "title": "Partner patient ID conflict",
    "detail": "Partner patient ID 'CLINIKO#12345' is already in use by another patient. Please use a unique identifier."
  },
  "timestamp": "2024-01-15T10:30:00.000Z",
  "requestId": "req_1705312200000_jkl012"
}

Unauthorized (401)

{
  "success": false,
  "statusCode": 401,
  "error": {
    "type": "https://parchment.health/errors/authentication-required",
    "title": "Unauthorized",
    "detail": "Valid authentication token is required"
  },
  "timestamp": "2024-01-15T10:30:00.000Z",
  "requestId": "req_1705312200000_mno345"
}

Insufficient Permissions (403 Forbidden)

{
  "success": false,
  "statusCode": 403,
  "error": {
    "type": "https://parchment.health/errors/insufficient-scope",
    "title": "Insufficient permissions",
    "detail": "This operation requires the 'CREATE_PATIENT' scope"
  },
  "timestamp": "2024-01-15T10:30:00.000Z",
  "requestId": "req_1705312200000_pqr678"
}

Response Fields

Success Response Data

FieldTypeDescription
external_patient_idstringYour system’s patient identifier (as provided in request)
parchment_patient_idstringParchment’s unique patient identifier
urlstringDirect link to patient in Parchment portal

Common Response Fields

All responses include these standard fields:
FieldTypeDescription
successbooleanIndicates if the request was successful
statusCodenumberHTTP status code
timestampstringISO 8601 timestamp of the response
requestIdstringUnique identifier for debugging

Status Codes

CodeStatusDescription
201CreatedPatient successfully created
202AcceptedPatient creation accepted (demographic conflicts found)
400Bad RequestInvalid request format or missing required fields
401UnauthorizedAuthentication required or token invalid
403ForbiddenInsufficient permissions (missing CREATE_PATIENT scope)
409ConflictPartner patient ID already exists
422Unprocessable EntityRequest validation failed
500Internal Server ErrorUnexpected server error

Error Handling

async function createPatient(patientData) {
  try {
    const response = await fetch(
      "/v1/organizations/org123/users/user456/patients",
      {
        method: "POST",
        headers: {
          Authorization: "Bearer your_jwt_token",
          "Content-Type": "application/json",
        },
        body: JSON.stringify(patientData),
      }
    );

    const result = await response.json();

    if (result.success) {
      // Handle success
      console.log("Patient created:", result.data.parchment_patient_id);
      return result.data;
    } else {
      // Handle error
      console.error("Error:", result.error.detail);

      // Handle specific error types
      switch (result.statusCode) {
        case 422:
          // Show validation errors
          result.error.validation.forEach((err) => {
            console.error(`${err.field}: ${err.message}`);
          });
          break;
        case 409:
          // Handle partner patient ID conflict
          console.error("Patient ID already exists");
          break;
        case 401:
          // Handle authentication error
          console.error("Please log in again");
          break;
        default:
          console.error("Unexpected error occurred");
      }

      // Always log requestId for debugging
      console.log("Request ID:", result.requestId);
    }
  } catch (error) {
    console.error("Network error:", error);
  }
}

Field Validation Requirements

Phone Number Format

The phone field accepts Australian phone numbers in the following formats: ✅ Valid Examples:
  • 0412345678 - Mobile number (domestic format)
  • 0312345678 - Melbourne landline (domestic format)
  • 0212345678 - Sydney landline (domestic format)
  • 0712345678 - Brisbane landline (domestic format)
  • 0812345678 - Adelaide landline (domestic format)
  • 61412345678 - International mobile (without + prefix)
  • +61312345678 - International landline (with + prefix)
❌ Invalid Examples:
  • 0123456789 - Starts with 1 (invalid area code)
  • 04123456789 - Too many digits
  • 041234567 - Too few digits
  • 04-1234-5678 - Contains formatting characters
  • +1234567890 - Non-Australian number

String Length Requirements

  • Family Name: 1-255 characters, cannot be empty
  • Given Name: 1-255 characters, cannot be empty
  • Partner Patient ID: 1-150 characters, must be unique
  • Street Number: 1-5 characters
  • Street Name: 1-100 characters
  • Suburb: 1-100 characters
  • Postcode: Exactly 4 digits (e.g., “3000”, “2000”)

Integration Notes

  1. Store Request ID: Always log the requestId for debugging support requests
  2. Handle 202 Status: A 202 response indicates demographic conflicts were found but a matching patient was returned
  3. Validation Errors: Use the error.validation array to display field-specific error messages
  4. Partner Patient ID: Must be unique across your organization; use the format returned in external_patient_id
  5. URL Access: The returned url provides direct access to the patient in the Parchment portal
  6. Phone Validation: Phone numbers must follow Australian format - see validation requirements above

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-organization-secret
string
required

Organization secret for authentication - provided by Parchment

Path Parameters

organization_id
string<uuid>
required

Organization ID

user_id
string<uuid>
required

User ID

Body

application/json

Patient data to add to Parchment

Patient information to be created

given_name
string
required

Patient's given name

family_name
string
required

Patient's family name

date_of_birth
string<date>
required

Patient's date of birth in YYYY-MM-DD format

sex
enum<string>
required

Patient's sex

Available options:
M,
F,
N,
I
partner_patient_id
string
required

Partner's unique identifier for the patient

dva_file_number
string

DVA file number

medicare_card_number
string

Medicare card number

medicare_irn
string

Medicare IRN

email
string<email>

Patient's email address (optional)

phone
string

Patient's Australian phone number (optional). Must be a valid Australian number with digits only. Supports mobile (04xxxxxxxx) and landline (0[2378]xxxxxxxx) formats. International format with +61 or 61 prefix is also accepted.

australian_street_address
object
medicare_valid_to
string<date>

Medicare card expiry date

concession_pension_number
string

Concession or pension number

entitlement_number
string

Entitlement number

dva_card_color
enum<string>

DVA card color

Available options:
gold,
white,
orange
racf_id
string

RACF identifier

ctg_eligible
boolean

Closing the Gap eligibility

indigenous_type
enum<string>

Patient's indigenous status

Available options:
aboriginal,
torres_strait_islander,
both,
neither,
not_stated
partner_id
string

Partner's unique identifier for the organization

Response

Patient created successfully

success
boolean
required

Indicates if the request was successful

Example:

true

statusCode
integer
required

HTTP status code

Example:

201

message
string
required

Human-readable success message

Example:

"Patient created successfully"

data
object
required

Response payload data Patient creation response data

timestamp
string<date-time>
required

ISO 8601 timestamp of the response

Example:

"2024-01-15T10:30:00.000Z"

requestId
string
required

Unique identifier for request tracing

Example:

"req_1705312200000_abc123"

pagination
object

Pagination information for list operations