Skip to main content
POST
/
{resourceType}
Create Resource
curl --request POST \
  --url http://localhost:8080/fhir/{resourceType} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/fhir+json' \
  --data '
{
  "resourceType": "<string>"
}
'
{
  "resourceType": "Patient",
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "meta": {
    "versionId": "1",
    "lastUpdated": "2026-01-12T10:30:00.000Z"
  },
  "name": [
    {
      "family": "Doe",
      "given": ["John"]
    }
  ],
  "gender": "male",
  "birthDate": "1990-01-01",
  "identifier": [
    {
      "system": "http://hospital.example/mrn",
      "value": "12345"
    }
  ]
}
Creates a new FHIR resource. The server assigns a unique ID and returns the created resource with metadata.

Endpoint

POST /fhir/{resourceType}
resourceType
string
required
The FHIR resource type (e.g., Patient, Observation, Encounter)

Headers

Content-Type
string
required
Must be application/fhir+json or application/fhir+xml
Accept
string
Response format: application/fhir+json (default) or application/fhir+xml
Prefer
string
Response style:
  • return=representation (default) - Return full resource
  • return=minimal - Return headers only
  • return=OperationOutcome - Return OperationOutcome
If-None-Exist
string
Conditional create. Search parameters to check for existing resource.Example: identifier=http://hospital.example/mrn|12345

Request Body

{
  "resourceType": "Patient",
  "name": [
    {
      "family": "Doe",
      "given": ["John"]
    }
  ],
  "gender": "male",
  "birthDate": "1990-01-01",
  "identifier": [
    {
      "system": "http://hospital.example/mrn",
      "value": "12345"
    }
  ]
}
ID in Body: Any id field in the request body is ignored. The server always assigns IDs for POST requests. Use PUT if you need to specify the ID.

Response

201 Created

Resource created successfully. Returns the new resource with server-assigned metadata.
id
string
required
Server-assigned unique identifier (typically UUID)
meta.versionId
string
required
Version number (starts at “1”)
meta.lastUpdated
string
required
ISO 8601 timestamp of creation
{
  "resourceType": "Patient",
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "meta": {
    "versionId": "1",
    "lastUpdated": "2026-01-12T10:30:00.000Z"
  },
  "name": [
    {
      "family": "Doe",
      "given": ["John"]
    }
  ],
  "gender": "male",
  "birthDate": "1990-01-01",
  "identifier": [
    {
      "system": "http://hospital.example/mrn",
      "value": "12345"
    }
  ]
}

200 OK (Conditional Create - Existing Resource)

When using If-None-Exist and a matching resource already exists.
{
  "resourceType": "Patient",
  "id": "existing-patient-id",
  "meta": {
    "versionId": "3",
    "lastUpdated": "2026-01-10T08:15:00.000Z"
  },
  "name": [
    {
      "family": "Doe",
      "given": ["John"]
    }
  ],
  "identifier": [
    {
      "system": "http://hospital.example/mrn",
      "value": "12345"
    }
  ]
}

400 Bad Request

Validation failed or malformed request.
{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "required",
      "expression": ["Patient.name"],
      "diagnostics": "Patient.name is required (minimum cardinality: 1)"
    },
    {
      "severity": "error",
      "code": "invalid",
      "expression": ["Patient.birthDate"],
      "diagnostics": "Invalid date format: expected YYYY-MM-DD"
    }
  ]
}

412 Precondition Failed

Conditional create found multiple matching resources (ambiguous).
{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "multiple-matches",
      "diagnostics": "Multiple resources match the If-None-Exist criteria. Cannot determine which to return."
    }
  ]
}

422 Unprocessable Entity

Resource violates business rules or profile constraints.
{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "business-rule",
      "diagnostics": "Patient must have at least one identifier in this profile"
    }
  ]
}

Examples

curl -X POST "https://your-server.com/fhir/Patient" \
  -H "Content-Type: application/fhir+json" \
  -H "Accept: application/fhir+json" \
  -d '{
    "resourceType": "Patient",
    "name": [{"family": "Doe", "given": ["John"]}],
    "gender": "male",
    "birthDate": "1990-01-01"
  }'

See Also

Authorizations

Authorization
string
header
required

Bearer token authentication

Path Parameters

resourceType
string
required

The FHIR resource type (e.g., Patient, Observation, Encounter)

Body

The FHIR resource to create

A FHIR resource. All resources have resourceType, id, and meta fields.

resourceType
string
required

The type of resource

id
string

Logical id of this artifact

meta
object

Metadata about a resource

Response

Resource already exists (conditional create)

A FHIR resource. All resources have resourceType, id, and meta fields.

resourceType
string
required

The type of resource

id
string

Logical id of this artifact

meta
object

Metadata about a resource